![]() |
Problem with update data (reduce value) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Problem with update data (reduce value) (/showthread.php?tid=50771) |
Problem with update data (reduce value) - El Forum - 04-07-2012 [eluser]Carmichael[/eluser] Code: function reduce_credits($id, $credits) When I run that function it updates the user_credits column to 0 insted of reduce the current value. Why? Problem with update data (reduce value) - El Forum - 04-07-2012 [eluser]Carmichael[/eluser] I solved it Code: $this->db->where('user_id',$id); Problem with update data (reduce value) - El Forum - 04-07-2012 [eluser]Samus[/eluser] Because the 2nd parameter is expected to be an array. But explain what you're trying to do abit. I'm a little confused here: Code: user_credits = user_credits - '.$credits.'' Something tells me you're trying to subtract the value of column 'user_credits' by $credits? |