Welcome Guest, Not a member yet? Register   Sign In
LIMIT
#1

[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.
#2

[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() {
    return $this->db->get('noticias', 10);
}
#3

[eluser]Browser[/eluser]
But, i want to select the rows 1 to 10. LIMIT 10,1 in mysql.
#4

[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() {
    return $this->db->get('noticias', 10, 1);
}
#5

[eluser]Browser[/eluser]
But it dont show anything Sad
#6

[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);




Theme © iAndrew 2016 - Forum software by © MyBB