$this->ModelName->id also works.
On May 7, 9:33 am, Günther Theilen wrote:
> 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
>
> >
You dont have to do it Gunthers way.
$this->Model->save($data);
// After save, id is the last inserted id
$id = $this->Model->id;
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this gr
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
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 th
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