Getting the ID value recorded in the current inserted database _ PHP Tutorial

Source: Internet
Author: User
Obtains the ID of the record currently inserted into the database. In PHP, the id value inserted into the database is often taken out, and there is such a function :? Php executes the statement $ getIDmysql_insert_id () to insert data into the database. $ getID is the most in PHP. it is often necessary to obtain the id value in the inserted database, and there is such a function:

// Execute the statement for inserting 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 is executed.

Why :? Php // execute the insert database statement // $ getID = mysql_insert_id (); // $ getID is the most...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.