Best way to update -> Table --> name + value field

#1
[eluser]internut[/eluser]
Suggestions welcome. I'm not sure how to go about it just yet:

--
-- Table structure for table `settings`
--

Structure:

Code:
CREATE TABLE IF NOT EXISTS `settings` (
  `name` varchar(255) NOT NULL default '',
  `setting` mediumtext NOT NULL,
  UNIQUE KEY `name` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

Is there a way I can take an array and update fields in this "settings" table?

Or do i need to make a single query with a WHERE name='setting_name'

?

#2
[eluser]internut[/eluser]
I can do a line for each setting i want to update on a post. Which is:

Code:
$this->db->query("UPDATE settings SET setting='$_POST[admin_email]' WHERE name='admin_email'");

better way?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.