CodeIgniter Forums
get(), with limit dont work?? - 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: get(), with limit dont work?? (/showthread.php?tid=7320)



get(), with limit dont work?? - El Forum - 04-03-2008

[eluser]Lucas Caleto[/eluser]
Hi Guys, me again...

i am try this on my model:

$query = $this->db->get('produtos',0,3);
return $query;

And nothen come back




when i use this:

$query = $this->db->get('produtos');
return $query;

work, but i need to control this limit's


i dont understand the problem

some one can help me ?

thanks

Lucas


get(), with limit dont work?? - El Forum - 04-03-2008

[eluser]alexsancho[/eluser]
try

Code:
$query = $this->db->limit(0,3)->get(’produtos’);
    return $query;



get(), with limit dont work?? - El Forum - 04-03-2008

[eluser]Lucas Caleto[/eluser]
I try,
the same problem
nothen come back Sad


get(), with limit dont work?? - El Forum - 04-03-2008

[eluser]barbazul[/eluser]
the order of the parameters is wrong

when using liimit, the first parameter is the number of rows and the second is the starting offset.

your query is asking the DB to retrieve 0 rows starting from the third, and that's what you get: NOTHING Big Grin


get(), with limit dont work?? - El Forum - 04-03-2008

[eluser]Lucas Caleto[/eluser]
Thanksss Big Grin
now work Big Grin