how about before the script run to the line "mysql_insert_id( ..) " , Another user that logined in insert another row ..
mysql_insert_id() returns the last inserted auto_increment value of the current database connection.
If you have two users inserting records at the same time, they both use a seperate connection. So yes, it is safe.