Last Inserted ID in PHP Mysql

Getting the last inserted ID in PHP(Mysql) is not too bad.
I am assuming that you already have a connection to the database;

echo mysql_insert_id();

or

$result = mysql_query ('SELECT LAST_INSERT_ID()');
$row    = mysql_fetch_array($result);
echo  $row[0];