Just being picky - you don't need limit => 1 if you are doing a find first.

Jeremy Burns
[email protected]


On 11 May 2010, at 23:33, Stefano Martins wrote:

> This should do the trick:
> 
> public function bla()
> {
>       $lastPost = $this->Post->find('first', array('order' =>
> array('Post.id DESC'), 'limit' => '1'));
> }
> 
> Cya!
> 
> On 11 maio, 09:42, Andrei Mita <[email protected]> wrote:
>> Do you want to edit the last row or the last inserted row?
>> 
>> 
>> 
>> On Tue, May 11, 2010 at 3:00 PM, Jeremy Burns <[email protected]> wrote:
>>> Do a find first sorted by id desc, then do a straightforward edit.
>> 
>>> Something like should get the last row:
>> 
>>> $row = $this->Model->find(
>>>        'first',
>>>        array(
>>>                'order' => array('Model.id DESC')
>>>                'recursive' => -1
>>>        )
>>> );
>> 
>>> Jeremy Burns
>>> [email protected]
>>> On 11 May 2010, at 12:52, Master Ram wrote:
>> 
>>>> hi.. all i want edit last row in the table.... how to do. if possible
>>>> send a sample code..
>> 
>>>> thank
>> 
>>>> Check out the new CakePHP Questions sitehttp://cakeqs.organd help
>>> others with their CakePHP related questions.
>> 
>>>> You received this message because you are subscribed to the Google Groups
>>> "CakePHP" group.
>>>> To post to this group, send email to [email protected]
>>>> To unsubscribe from this group, send email to
>>>> [email protected]<cake-php%[email protected]>For
>>>>  more options, visit this group at
>>> http://groups.google.com/group/cake-php?hl=en
>> 
>>> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
>>> with their CakePHP related questions.
>> 
>>> You received this message because you are subscribed to the Google Groups
>>> "CakePHP" group.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]<cake-php%[email protected]>For
>>>  more options, visit this group at
>>> http://groups.google.com/group/cake-php?hl=en
>> 
>> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
>> with their CakePHP related questions.
>> 
>> You received this message because you are subscribed to the Google Groups 
>> "CakePHP" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected] For more options, visit this group 
>> athttp://groups.google.com/group/cake-php?hl=en
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to