This article to introduce PHP to get just inserted data id value method, PHP provides the mysql_insert_id () function We just add the data after inserting Echo mysql_insert_id ().
Example
The code is as follows |
Copy Code |
Execute the statement that inserts 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.
There's another way.
The code is as follows |
Copy Code |
Msyql_query ("Select last_insert_id ()"); |
LAST_INSERT_ID () is a MySQL function that is also valid for the current link
This usage resolves the bigint type problem encountered in mysql_insert_id ()
http://www.bkjia.com/PHPjc/628794.html www.bkjia.com true http://www.bkjia.com/PHPjc/628794.html techarticle this article to introduce PHP to get just inserted data id value method, PHP provides the mysql_insert_id () function We just add the data after inserting Echo mysql_insert_id (). Example ...