CodeIgniter Forums
ActiveRecord class question - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: ActiveRecord class question (/showthread.php?tid=19085)



ActiveRecord class question - El Forum - 05-27-2009

[eluser]i_am_using_ci[/eluser]
Hi, I wanted to ask is there any way to do query like:
Code:
update table set field = filed + 1 where id = 1
with ActiveRecord class?

I am always getting
Code:
update table set field = 'field + 1' where id = 1

when doing:
Code:
$this->db->where('id', 1);
$this->db->update('table', array('checks' = 'checks + 1'));



ActiveRecord class question - El Forum - 05-27-2009

[eluser]Dam1an[/eluser]
See the part on set in the AR user guide
Set accepts a 3rd parameter to prevent escaping things like this


ActiveRecord class question - El Forum - 05-27-2009

[eluser]i_am_using_ci[/eluser]
Thanks! Smile