Pregunta

Below cakephp query returns an empty array result but if I use only $max_results it works. I want to search for a record from two limits (0,10).

This doesn't work.

$from = 0;
$max_results = 10;
$this->Model->find('all',array(
      'conditions'=>$condition,
      "order"=>'Model.id DESC',
      'limit'=>"$from,$max_results"
));
¿Fue útil?

Solución

You need to use offset options-

   $from = 0;
    $max_results = 10;
    $this->Model->find('all',array(
          'conditions'=>$condition,
          "order"=>'Model.id DESC',
          'limit'=>"$max_results",
          'offset' => "$from"
    ));
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top