Code
Result

PHP code example: mysql_insert_id

Get the ID generated in the last query. See documentation.

You can try this function yourself. Just edit the code and on "Run" to see the result.