문제

I want to display links of first and previous record. I use following code but it returns empty.

$neighbors = $this->names->find('neighbors', array('conditions'=>array('names.Id'=>12),'limit'=>1));

This is my working code below, which returns data for the current record

$this->set("names", $this->names->find('all',array('conditions'=>array('names.Id'=>$id))));

How can I achieve this. Please help me.

Thanks

도움이 되었습니까?

해결책

As docs says http://book.cakephp.org/2.0/en/models/retrieving-your-data.html, you need to do like this

$neighbors = $this->names->find(
        'neighbors',
        array('field' => 'Id', 'value' => 12)
    );
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top