Hi guys. I'm looking to create an options table in my db that makes every record a system option, so I can work with a little number of fields.
My db has the following structure:
- 3 columns named
id
,name
, andvalue
The following data is inserted as an example:
+--+-----------+--------------------------+
|id|name |value |
+--+-----------+--------------------------+
| 1|uri |www.example.com |
| 2|sitename |Working it out |
| 3|base_folder|/folder1/folder2/ |
| 4|slogan |Just a slogan for the site|
+--+-----------+--------------------------+
That way I can include a large number of customizable system options very easily.
The problem is that I don't know how to retrieve them.
How do I get the value of uri and
store it as a var?
And better yet, how do I get, for exmaple, values of id
1 and 4 only without making a query each time? (I assume multiple queries are useless and a pretty ugly method.)
I know the question is pretty basic but I'm lost here. I'd really appreciate your answer!