mysql_insert_id() returns(!) the value
that was inserted into the of the auto_increment
column of your table during the latest insert operation
done through the connection that you are requesting the mysql_insert_id() for.
This means that if you run many copies of your script at the same time, each copy will return the insert_id of the record that was last inserted using it's own connection.
The scripts will not mess eachother up.
So, if I insert a record into a table where there is an auto_increment column, the new record will get a new unique value. This value is returned when you call mysql_insert_id().
You should never ever have to set this value, it is created automatically by the database engine.
If you want to insert a record and select that new record immediately afterwards;
mysql_query("insert bla",$db_link_identifier);
$insert_id=mysql_insert_id($db_link_identifier);
mysql_query("select bla where ID=$insert_id",$db_link_identifier);