Sorry, typo.

It should be getInsertID().

> Hi,
> 
> $last_id = $this->ModelName->getInsertId() should do the trick.
> http://api.cakephp.org/class/model#method-ModelgetInsertID
> 
> Regards
> Guenther
> 
> Roman Brunnemann write:
>> Hi,
>>
>> quick question from a newbie. After saving data that will result in a 
>> create, I'd like to retrieve the ID from the auto increment field in the 
>> database.
>>
>> e.g. I have a database table "person" with columns id, name, city.
>>
>> Now I create an array $array['Person'] = array( "name" => "John Smith", 
>> "city" => "New York" ), and call the save-method. Now a new record in 
>> the database is generated with a new id from the mysql auto increment 
>> function. My question is, how do I get this id, because next thing I'd 
>> like to to is to go to the view of this person. Therefor I need the id.
>>
>> Thanks a lot for your help.
>> Roman
>>
> 
> 
> > 



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

Reply via email to