![]() |
AR update bug when calculating with fields - 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: AR update bug when calculating with fields (/showthread.php?tid=5057) |
AR update bug when calculating with fields - El Forum - 01-03-2008 [eluser]xwero[/eluser] I have a simple update query Quote:update menu set number = number-1 where number > ?But when i rewrite it as an AR update query Code: $data = array('number' => 'number-1'); Quote:UPDATE menu SET number = 'number-1' WHERE number > '2'And it subtracts all records. If no records were subtracted i could at least see the logic but this is just weird to me. AR update bug when calculating with fields - El Forum - 01-03-2008 [eluser]Derek Allard[/eluser] Funny. I just added this to AR last night, but it hasn't worked its way into the svn yet. Quote:set() will also accept an optional third parameter ($escape), that will prevent data from being escaped if set to FALSE. To illustrate the difference, here is set() used both with and without the escape parameter. This is will be in the svn shortly. AR update bug when calculating with fields - El Forum - 01-03-2008 [eluser]xwero[/eluser] Great, i didn't know about the set method but once it is available i'm going to use this nice addition. Another small addition in the AR class would be selecting the wildcard position for the like method; both (default), left, right Code: /** AR update bug when calculating with fields - El Forum - 01-03-2008 [eluser]Derek Allard[/eluser] Thats been in there since Dec 17 ![]() |