Page 1 of 1

Storing Config values in MySQL

Posted: Mon Jan 15, 2007 8:10 am
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

Posted: Mon Jan 15, 2007 9:32 am
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.

Posted: Mon Jan 15, 2007 10:02 am
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?