View Single Post
Old 11-21-2009, 08:38 PM   #3 (permalink)
delayedinsanity
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

mysql Code:
CREATE TABLE IF NOT EXISTS `my_options` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL DEFAULT '',
  `value` varchar(65535) NOT NULL,
  PRIMARY KEY (`id`,`name`)
) ENGINE=InnoDB

No sense in trying to mash everything into one row if you're going to use a database to begin with. Then you have to jump through hoops after selecting the data just to make it usable.

If you're using MySQL < 5.0.3 you would have to change the longer varchar to a text or longtext - this is of course assuming you want to eventually store long options values or arrays in that column. If all your options are now and forever only going to be true|false (on/off), then you could use the following instead;

mysql Code:
`value` enum('1') DEFAULT NULL,
delayedinsanity is offline  
Reply With Quote