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

[eluser]Fantass[/eluser]
Im trying to each time that access to the method updade +1 like a counter.. This is what i got
Code:
$this->db->where('id',$row->id);
        $update = array(
            'counter' => +1,
        );
        $this->db->update('table', $update);
But instead sum 1 write '1' In te row.
Thanks
#2

[eluser]InsiteFX[/eluser]
Code:
$this->db->set('field', 'field+1');
#3

[eluser]Aken[/eluser]
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