con php:
http://it2.php.net/manual/it/functio...-insert-id.php

con mySQL:
LAST_INSERT_ID()