I was doing a quick search to look for the same information you were, but then I remembered that I have the solution to it somewhere in my existing code.
I found it and am posting here, so others (including myself) can find the answer more easily.
look up the php function:
mysql_insert_id()
ah, hell. I'll look it up for you:
(PHP 3, PHP 4 )
mysql_insert_id -- Get the ID generated from the previous INSERT operation
Description
int mysql_insert_id ( [resource link_identifier])
mysql_insert_id() returns the ID generated for an AUTO_INCREMENT column by the previous INSERT query using the given link_identifier. If link_identifier isn't specified, the last opened link is assumed.