Home > Backend Development > PHP Tutorial > PHP gets the id value of the currently inserted database record

PHP gets the id value of the currently inserted database record

WBOY
Release: 2016-07-25 08:54:46
Original
1048 people have browsed it
  1. //Execute the statement inserted into the database
  2. //…
  3. $getID=mysql_insert_id();//$getID is the ID of the last record
  4. ?>
Copy code

Code description: The PHP function mysql_insert_id() returns the value of the field defined by AUTO_INCREMENT after the last INSERT query was executed.



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