mysql_insert_id

 int mysql_insert_id ([ resource $link_identifier ] ) 

説明

Retrieves the ID generated for an AUTO_INCREMENT column by the previous query (usually INSERT).

戻り値

The ID generated for an AUTO_INCREMENT column by the previous query on success, 0 if the previous query does not generate an AUTO_INCREMENT value, or FALSE if no MySQL connection was established.