Hi Wee, > Is it possible that I would get the wrong ID (Not the ID I just inserted in > Auto_Increment field) by using mysql_insert_id function if someone is also > inserting record at the same time? How does mysql_insert_id work accurately?
=A couple of things here: 1 if the field is defined as "Auto_Increment" then YOU will not insert an ID. Leave the field out of the INSERT statement or transfer NULL, and MySQL will insert the correct ID value according to the 'increment' policy. The construction of the mysql_insert_id() looks like this: $AutoIncrementId = mysql_insert_id( $MySQLConnection ); Note that the function argument is the connection to MySQL (not the db/tbl !). Thus the ID is a by-product of the connection (and the most recent INSERT it handled) - re-read the appropriate page in the manual for more information, if required. 2 because the (function argument) controlling feature is the connection, it is not possible for another concurrent user to 'steal' your ID or influence the ID returned to you - it's all yours! The only way to get the "wrong" ID is to perform two IDs and then (vainly) try to get hold of the previous ID - only the latest ID is available. Clear now? =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]