How can I find a result by its row number?

192 views Asked by At

Say I have two models, Foo belongsTo Bar:

$this->Foo->find('first',array(
    'conditions'=>array(
        'barRowNumber'=>$barRowNumber,
        'fooRowNumber'=>$fooRowNumber)));

I can't just do the auto_increment id because they skip around when I add and delete records. So how can I use row number as a parameter for a find query in CakePHP?

1

There are 1 answers

0
Ikong On
  1. If you dont have id then you should count the row where your search occur.
  2. If you have ID then $this->Foo->id = $value is the key
  3. If you have other search value then $this->Foo->findbyYourValue will do