<?php

   mysql_query("INSERT INTO table (nom_table) values ('ex')");
   $dernier_id =  mysql_insert_id();
   echo $dernier_id;

?>