mysql_insert_id() returns NULL or 0
If you have multiple mysql connections (i.e. mysql_connect() or mysqli_connect()) on the page you will need to specify the the connection you are using when calling this function. example: mysql_insert_id($MY_CONN);