PHP and MySQL Insert ID

From: Date: Wed, 01 Aug 2001 09:06:06 +0000
Subject: PHP and MySQL Insert ID
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-60605@lists.php.net to get a copy of this message
Hello everyone ! Question: I'm building an online membership registration system, for a 'membership section' of a website. As it stands, I have a registration form that insert the data into MySQL, then generate a confirmation page--with member ID number, username, and password. I want to use PHP's mysql_insert_id to capture the last ID that was entered...and that's where my question lies. In an environment where it's possible to have multiple users register at the same time (relatively speaking), how can I be sure that the 'last ID' is indeed the 'intended' last user's ID? Ex. Say that user A submit a registration form at 00:00:01, but mysql_inserted_id is not called (for user A) until 00:00:03. If user B submits a registration for at 00:00:02, then would the call to mysql_insert_id (for user A---called at 00:00:03) return the ID for user B? Technically, it sounds like it would, unless mysql_insert_id implements some type of session and/or state recognition. Is that how it works? --How can I be sure that it returns the ID for user A and not B? --Does mysql_insert_id implement some internal session function, or something to that effect? How does it account for that? Please help. Thanks in advance. -John __________John Monfort_________________ _+-----------------------------------+_ P E P I E D E S I G N S www.pepiedesigns.com "The world is waiting, are you ready?" -+___________________________________+-

« previous php.general (#60605) next »