mysql_insert_id() doesn't work

Hi,

I’ve attempted about 20 different variations of what is effectively the same job; and I just can’t get it to work. :anger:

I’ve inserted some information into the mysql database. Now all I want is to return the ID. The ID is auto_increment and has Zerofill. I’m not sure if this is effecting my attempt, but all I get is a single 0. What am I doing wrong?

$SQL = "INSERT INTO db_table (name, email) VALUES ('$name', '$email')";
echo "The last inserted ID was : " . mysql_insert_id();

Thanks, Mark.