CodeIgniter Forums
$this->db->set() - 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: $this->db->set() (/showthread.php?tid=35640)



$this->db->set() - El Forum - 11-05-2010

[eluser]tyuwan[/eluser]
This may seems small, but I was wonder why this doesn't work?

$this->db->set('count','count+1');
$this->db->where('id',$id);
$this->db->update('table');


$this->db->set() - El Forum - 11-05-2010

[eluser]WanWizard[/eluser]
Do an
Code:
echo $this->db->last_query();
and it will become clear.

'count+1' is taken as a literal and escaped. Check the manual on how to deal with this.


$this->db->set() - El Forum - 11-05-2010

[eluser]Crimp[/eluser]
For ref.

Code:
$this->db->set(‘count’,‘count+1’, FALSE);



$this->db->set() - El Forum - 11-05-2010

[eluser]tyuwan[/eluser]
Awesome, Thank you, I was wondering what was the FALSE for.