int mysql_insert_id
([int
link_identifier])
mysql_insert_id() returns the ID generated for an AUTO_INCREMENTED field. It will return the auto-generated ID returned by the last INSERT query performed using the given link_identifier. If link_identifier isn't specified, the last opened link is assumed.