Storing Config values in MySQL

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
decipher
Forum Commoner
Posts: 38
Joined: Mon Mar 13, 2006 6:27 am
Location: south africa

Storing Config values in MySQL

Post by decipher »

I was wondering what the best method for storing config values in the database would be.
I have it simply has:

Code: Select all

CREATE TABLE `config` (
  `ID` int(11) NOT NULL auto_increment,
  `name` varchar(150) NOT NULL default '',
  `value` text NOT NULL,
  `dateupdated` datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (`ID`)
) AUTO_INCREMENT=1 ;
When calling the config values, I will simply build an associative array as: name => value
Is this the best method, anyone got any prior experience with a better method?
Many thanks,
Rich
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Which variant of best are we talking about here?

When I do such things, it's only the name-value pair, nothing else.
decipher
Forum Commoner
Posts: 38
Joined: Mon Mar 13, 2006 6:27 am
Location: south africa

Post by decipher »

Not sure, just wanted to get some opinions.
I guess the name value pair is all u need.

Should I define the name column as Primary Key?
Post Reply