What is diffrent between the two?
LAST_INSERT_ID() and mysql_insert_id()
Well, let's start with the obvious: LAST_INSERT_ID is a mysql function, and mysql_insert_id is a PHP function.
Now, the less than obvious: LAST_INSERT_ID will hold the current value of the most recently inserted ID, and can be used to pull that value with no dependencies on any other function... It can also be run without a dependency on PHP.
mysql_insert_id is dependent on the auto-incrememnt field having a new number generated in order to be updated, and needs to be called immediately after a query call that creates a new auto-increment number, to get the most recent. It also requires MySQL, since it is dependent on queries.
So mysql_insert_id won't work with UPDATE?
And what do you mean by "to be called immediately after a query"?