In PHP, it is often necessary to retrieve the id value inserted into the database, and there happens to be such a function:
//Execute the statement inserted into the database
//……
$getID=mysql_insert_id();//$getID is the ID of the last record
?>
The PHP function mysql_insert_id() returns the value of the field defined by AUTO_INCREMENT after the last INSERT query was executed.