Welcome Guest, Not a member yet? Register   Sign In
Active Record Update Sum 1

Im trying to each time that access to the method updade +1 like a counter.. This is what i got
        $update = array(
            'counter' => +1,
        $this->db->update('table', $update);
But instead sum 1 write '1' In te row.

$this->db->set('field', 'field+1');

Make sure to set the third parameter of the set() method to FALSE to keep active record from escaping your code. I don't think it'll work for most DBs without it. There's an example of this in the user guide for the set() method: http://ellislab.com/codeigniter/user-gui...tml#insert

Theme © iAndrew 2016 - Forum software by © MyBB