How to get last insert id after call $dw->save();

timothy259856

Active member
Hello guys!

When I execute an insert item to my table use $dw->save(); how can I get the id which created after call save()?

I know that Zend support the $db->lastInsertId() but where to do this? Do I need do anything in the DataWriter?

Thank you!
 
Are you sure the $dw->save(); actually worked without errors? You're not forcing the errors to be silent? Can you see the data in the database at that point?

This approach is used throughout XenForo to get the data that's just been saved to the database.
 
Are you sure the $dw->save(); actually worked without errors? You're not forcing the errors to be silent? Can you see the data in the database at that point?

This approach is used throughout XenForo to get the data that's just been saved to the database.

Yes, I do the check, I saw the data was insert in database. I can get others field but not for the key.
 
Back
Top Bottom