Re: Get autoincrement ID after save (insert)

2009-05-07 Thread Walther
$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 > > >

Re: Get autoincrement ID after save (insert)

2009-05-07 Thread Miles J
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

Re: Get autoincrement ID after save (insert)

2009-05-07 Thread Günther Theilen
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

Re: Get autoincrement ID after save (insert)

2009-05-07 Thread Günther Theilen
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

Get autoincrement ID after save (insert)

2009-05-07 Thread Roman Brunnemann
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