-2

I need to find two previous articles. Lets say, I got one article from database:

    Array
(
    [0] => Array
        (
            [Pressroom] => Array
                (
                    [id] => 44
                    [created] => 2013-04-17 07:38:20
                    [date] => 2013-04-17
                    [modified] => 2013-04-23 07:58:25
                )

        )

And I need also find two previos records (Lets say with id 43 and 42). Any sugestions? I totaly got no idea.

I tried to use this code in my model:

$this->find('all',
            array(
                'order' => array(
                    'Pressroom.date' => 'DESC',
                    'Pressroom.created' => 'DESC'
                ),
                'limit' => 2,
                'conditions' => array('Pressroom.date <' => $data['Pressroom']['date'])));

But it finds two records with id 1 and 2, instead of 43 and 42

4

1 に答える 1