Re: PHP and MySQL Insert ID
| From: | John Monfort | Date: | Wed, 01 Aug 2001 10:34:24 +0000 |
| Subject: | Re: PHP and MySQL Insert ID | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-60620@lists.php.net to get a copy of this message | ||
Many thanks, Daniel!
I trully appreciate it.
-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?"
-+___________________________________+-
On Wed, 1 Aug 2001, Daniel Rezny wrote:
> Hello John,
>
> Wednesday, August 01, 2001, 11:06:06 AM, you wrote:
>
>
> JM> In an environment where it's possible to have multiple
> JM> users register at the same time (relatively speaking), how can I be sure
> JM> that the 'last ID' is indeed the 'intended' last user's ID?
>
> JM> Ex.
> JM> Say that user A submit a registration form at 00:00:01, but
> JM> mysql_inserted_id is not called (for user A) until 00:00:03.
>
> JM> If user B submits a registration for at 00:00:02, then would
> JM> the call to mysql_insert_id (for user A---called at 00:00:03) return
> JM> the ID for user B?
>
> JM> Technically, it sounds like it would, unless mysql_insert_id implements
> JM> some type of session and/or state recognition.
> JM> Is that how it works?
>
> JM> --How can I be sure that it returns the ID for user A and not B?
>
> You can be 100% sure, 'cause mysql_insert_id() returning last inserted
> id in current connection to database.
>
> User A has another connection ID as user B.
>
> I hope it helps
>
> --
> Best regards,
> Daniel mailto:daniel@rezny.sk
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>