Get The Last Inserted ID when using Zend_Db

I was working in migration script which I am only using Zend_Db Component with the MVC (Normally I use Zend_Db_Table) and it seems that $db->insert(‘table_name’, $data); is not returning the last inserted id and after some investgation I fount that to get the last inserted id you should use the following method

$db->lastInsertId();

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>