Last inserted id in php mysql

Its very useful php function to  find  the last inserted id. when we are dealing with the php projects many times need to get the last inserted record’s id.

Here i have written the php function………..

In mysql get last inserted id by using php pre-defined function after the mysql execution

$last_id = mysql_insert_id();

In mysqli

$last_id =mysqli_insert_id();


$last_id =lastInsertId();

Vijay maurya

Vijay maurya is a web developer having several years experience and passionate about programming. Vijay worked in many project along with reputed companies. The main aim of blogging is to spread knowledge who need help in development and also to improve knowledge and skills.

Leave a Reply

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