No recognize null values with db->limit() VS db->get that - 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: No recognize null values with db->limit() VS db->get that (/showthread.php?tid=49392) |
No recognize null values with db->limit() VS db->get that - El Forum - 02-17-2012 [eluser]Unknown[/eluser] Hi people! I found a question that I think that's a bug 1r= $qry = $this->db->get($this->n_table, $num, $offset); if I set $num and $offset whit value null, the function hive me a correct response 2n= $this->db->limit($num, $offset); but I if use this function, the function doesn't recognize the values as null and think that the values is 0. So, the 1r recognize the null values and return me the correct result of the query and 2n no recognize the null values and return me a empty Array. Anybody can tell me why? Tnx x all! No recognize null values with db->limit() VS db->get that - El Forum - 02-20-2012 [eluser]aquary[/eluser] Check what was the query you got from both of them ($this->db->last_query()). Since NULL is a kind of...0, maybe CI's limit() undestand it that way and use 0, 0. No recognize null values with db->limit() VS db->get that - El Forum - 02-29-2012 [eluser]web-johnny[/eluser] OK the first thing that it comes to my mind is why to have a $this->db->limit(null) ? You can avoid this problem easily . So it make sense to me that when you add a parameter to limit just transform it to integer. The only right thing about this is the second parameter because there are some cases that perhaps we need to have a parameter for the second segment of the function. But then again there is not any problem with this as you will have the following results: Code: //This means I don't need any data Code: //This means I don't need the second parameter So in my opinion is not a bug as the function limit comments has a very specific structure: Code: /** |