Keyword

Using an item's "extra fields" in SQL queries

  • Andreas Renberg
  • Andreas Renberg's Avatar Topic Author
  • Offline
  • New Member
More
14 years 3 months ago #77145 by Andreas Renberg
Using an item's "extra fields" in SQL queries was created by Andreas Renberg
Right now what I am mostly doing is just modifying the bits and pieces of K2 code as they are needed, but I have run into an area where I need to be able to access 'extra fields' of items, and parsing the really long string containing the fields could get messy... :(

I might be able to get really complex, and do something along these lines:
SELECT * FROM "#__k2_items"
LIKE '%{"id":"8","value":"' .$ category_id . '"}%'

But I would rather not. I would have an EVEN WORSE time trying to retreive the category ID from a specific item in the table. I would need PHP to parse each record to extract the data, right?

Is there any efficient way to get the fields without using 3 different SQL queries and lots of parsing in PHP?

I could easily add a new column in the database, however, the people working on the site (the designers) would have a very difficult time because they constantly need to go to the database in order to change the extra field value. I would rather keep all database modifications up to me (the developer) and not need them to call me every time they add an item.


Any one have any ideas?

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum