Update query increment field plus 1 codeigniter
I got a problem when trying to increment by 1 on given field in my db. I tried with and without active records. My functions look like this (in my model) function _set_reads($id){ $this->db->set('reads', 'reads+1', FALSE) $this->db->where('id', $id); $this->db->update('article'); } and function _set_reads($id){ $sql = 'update article set reads=reads+1 where id=?'; $this->db->query($sql, array($id)); } I get the same error in both cases and it's the following error message: Error Number: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version