You can get the ID (AUTO_INCREMENT column as primary key) generated after you insert a new record in your table by a simple function "mysql_insert_id()".
This tutorial require 1 PHP file and 1 table of mySQL database.
get_last_id.php
Database "tutorial" and table "name_list" with 2 fields: id(auto_increment), name(varchar, 50).