how i can do that query:
UPDATE `xxx` SET `xx`=xx+1
with Active Record in Codeigniter ?
Thanks for your help ;-)
how i can do that query:
UPDATE `xxx` SET `xx`=xx+1
with Active Record in Codeigniter ?
Thanks for your help ;-)
Try with the following code:
//$this->db->where('id', 'yourid');
$this->db->set('xx', 'xx+1',FALSE);
$this->db->update('xxx');
Try this
$this->db->where('id',$id);
$this->db->update('xxx',array('xx',$xx+1));
$this->db->where('id', 'yourid');
$this->db->set('xx', '`xx`+1', FALSE);
$this->db->update('xxx');
Note the third parameter in the set
function.
This function tells CodeIgniter not to add a backtick (`) on the field.