It's because you call it with the link_id.
$number = mysql_insert_id($link_id);
That link_id is for the current script only, another script running at the same time doing an insert will have a different link_id, so it'll get its own number..
This is the most secure way to find out the number of the row you just inserted.
---John Holmes...