Php+mssql get last Insert ID value problem (online etc ~)
I remember MySQL has a mysql_insert_id () function to get the last inserted ID, such as $newid = mysql_insert_id (); What about the MSSQL database? Is there such a function? How do I output
Call MySQL in PHP, built-in last_insert_id () This function may not be used by anyone, the most used or mysql_insert_id ()
In fact, these two are different, last_insert_id () can return the ID of the bigint value. Instead, MYSQL_INSERT_ID returns
This problem has been encountered by the cliff before, too long did not write do not remember (seems to be the CI frame directly related functions), and then met again, rolled to check again, here is not the case is PDO, but with the outdated
many times we want to know when inserting data to MySQL The ID of the channel just inserted the data this is useful for us. Below I say three kinds of common methods and analyze their pros and cons one with the following statement: mysql_query ("
Three kinds of return to MySQL tutorial insert a record to return the record ID method
Method One
ID Int (one) not null PRI key auto_increment,name varchar (a), backup varchar (50)Now, when you want to insert a record, return his ID value (insert
PHP uses pods to access the mysql database. how to return the id idphp & nbsp; of the last inserted record and access the mysql database using & nbsp; POD & nbsp, how to return the auto-increment ID of the previous insert record share to: PHP uses
PHP uses pods to access the mysql database. how to return the id idphp & nbsp; of the last inserted record and access the mysql database using & nbsp; POD & nbsp, how to return the auto-increment ID of the previous insert record share to: PHP uses
mysql_query ("SELECT Max (ID) from T1", $link);
Copy CodeUsing this method gives the highest ID value, which is the last value, but when a multilink thread, this maximum ID is not necessarily the self-increment ID value of the inserted data,
Provides various official and user-released code examples. For code reference, you are welcome to learn how to fix the data insertion BUG in TP + ORACLE and obtain the auto-increment Id. The getLastInsID method is supported.
During Api operations
PHP uses POD to access MySQL database, how to return the last inserted record of the self-increment number ID
PHP uses POD to access MySQL database, how to return the last inserted record of the self-increment number ID
Share to:
more
---
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.