Giacomo P. Sat Jul 31 05:25:30 -0400 2010

Subject: Last inserted id

Hi all,
After a save() function in a table with an auto-increment pk, I would like to know which is the id just inserted.
I found the insert_id() method but I didn't understand how to use it .


Kien La Sat Jul 31 17:29:19 -0400 2010

The inserted pk will be assigned to the model's id:

$model = new YourModel();
$model->save();
echo $model->id;
Jhonny Silva Mon May 20 10:52:47 -0400 2013

I'm trying to use this insert_id() and can not in any way explain more how do I call the insert_id()

Jhonny Silva Tue May 21 12:25:32 -0400 2013

as I can Retrieve the insert id of the last model saved ????????????????

(1-3/3)