How To Get Last Insert id in Magento?

To get Last Insert Id in Magento you have to use specific code that will get you the desired result accordingly. With below given code you will be able to find the correct information easily.

Magento get last insert id:

$model = Mage::getModel('user/profile');
           ->setLastname ($lastName); 
     $lastInsrtedId = $model->getId();

The above example will provide you last inserted id in the database table.

Specifically $model->getId() gives you last inserted id.

You may also like...

Leave a Reply

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