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.