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 an int. If you
The ID of the unsigned int, or bigint. Then, it may be that the error is returned. Instead of using last_insert_id ()
Some friends, return is 0, do not know how, in fact, last_insert_id () returned is the ID of auto_increment.
If, in the table structure, there is no setting, auto_increment cannot return.
There are others, or return to 0. Then you'll have to check to see if you're using the Insert delay function. In this case, the immediate return ID value is not returned.
Many people like to use SELECT Max (ID) ... To replace this last_insert_id, in fact, select MAX (ID) is non-thread safe, and it is possible that
Other threads have inserted new data and you can't find the ID you last inserted. and last_insert_id is corresponding to a MySQL connect, which is
Corresponds to your current line threads and will not be disturbed by other threads. If there are some strange errors in your database, for example, to update the information of a data,
The result B data is updated, and is sometimes correct, sometimes incorrect, and when people are too many, they are very incorrect. We'll see if we're using select Max (ID).
Http://www.jb51.net/article/21063.htm