[eluser]Unknown[/eluser]
Hi,
I am writing some code to increment a field in my database.
Code:
$data = array(
'inc_field' => '(incField+1)'
);
$this->db->where('id', $id);
$this->db->update('my_table', $data);
I would normally write this as:
Code:
UPDATE my_table SET inc_field = (inc_field+1) WHERE id='{$id}'
CodeIgniter adds single quotes around (incField+1), as you would expect. However, this defeats my objective.
Is there a recommended way to achieve my goals? Or is my best alternative to modify the Active Record code?
Thanks,
David Edwards.
edit:
Code:
$this->db->set('inc_field', '(inc_field+1)', false);
This code filled my need. The false prevents escaping.