September 2001
Intermediate to advanced
768 pages
32h 45m
English
int mysql_insert_id([mysql link connection]) Gets the AUTO_INCREMENT value (if any) generated by the last query.
Returns:
Integer
Description:
mysql_insert_id() returns the AUTO_INCREMENT value (if any) generated by the last query made by the script calling mysql_insert_id(). If the connection argument is not set, the last connection opened is used by default.
mysql_insert_id() only returns a value if the last query on the specified connection handle caused an AUTO_INCREMENT column to generate a value. If you want to get the last AUTO_INCREMENT value generated, use the MySQL function LAST_INSERT_ID(). For example:
echo @ mysql_result (mysql_query ('SELECT LAST_INSERT_ID()')); mysql_insert_id() also returns the value for the ...
Read now
Unlock full access