Get the ID value of the record currently inserted into the database_PHP tutorial

WBOY
Release: 2016-07-13 17:03:51
Original
877 people have browsed it

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.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/630922.htmlTechArticleIn PHP, it is often necessary to take out the id value inserted into the database, and there happens to be such a function: ? php //Execute the statement inserted into the database // $getID=mysql_insert_id(); //$getID is the most...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!