![]() |
Incrementing a counter - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Incrementing a counter (/showthread.php?tid=27443) |
Incrementing a counter - El Forum - 02-11-2010 [eluser]Unknown[/eluser] Hi, How can I increment a counter using Active Record? This is not working for me: Code: $this->db->update('page', array('views' => 'views+1')); Please help. Incrementing a counter - El Forum - 02-11-2010 [eluser]LuckyFella73[/eluser] Hi everactive, try the SET function and use the additional parameter to prevent escaping: Code: $this->db->set('views', 'views+1', FALSE); User guide: Active Record Class / Update |