LIMIT |
[eluser]Browser[/eluser]
Hello, i am using the clause LIMIT for my example: function novedades() { $query=$this->db->get('noticias',1,10); return $query; } But, it dont show anything. However, this yes. function novedades() { $query=$this->db->get('noticias'); return $query; } Why? Thanks you.
[eluser]Jamie Rumbelow[/eluser]
You've got the parameter order wrong; the second parameter is the value for the LIMIT clause, the third is the OFFSET clause. Right now you're trying to select one row in the orders table, starting with the tenth. Oh yeah, and you don't need to assign $query at all - just return the result of $this->db->get() directly. Try this: Code: function novedades() {
[eluser]Browser[/eluser]
But, i want to select the rows 1 to 10. LIMIT 10,1 in mysql.
[eluser]Jamie Rumbelow[/eluser]
[quote author="Browser" date="1257114595"]But, i want to select the rows 1 to 10. LIMIT 10,1 in mysql.[/quote] The code above should do it; if not just pass 1 as the third parameter: Code: function novedades() {
[eluser]pistolPete[/eluser]
Enable the profiler to see which queries are generated: http://ellislab.com/codeigniter/user-gui...iling.html Code: $this->output->enable_profiler(TRUE); |
Welcome Guest, Not a member yet? Register Sign In |