RE: [PHP] mysql_insert_id()

From: Date: Wed, 24 Jan 2001 22:05:37 +0000
Subject: RE: [PHP] mysql_insert_id()
Groups: php.general 
Request: Send a blank email to php-general+get-36496@lists.php.net to get a copy of this message
> Instead of checking if(!$id), perhaps you would be better off to check the > result of your query (which in this example was successful, since you got > a return from mysql() ). I am. I just didn't include it in my previous message as it as I was trying to keep extraneous code down to a minimum. Plus, I mentioned in my initial post that there were no errors being returned and mysql() was in fact returning a 1 (true) as opposed to a 0 (false) as it's result. Both indicate that the query was successful. > Also, what is the last_insert_id() function that you are referencing in your > $insertIDQuery string? Internal mySQL function. > As for things getting messed up when two queries hit the system at the same > time, you shouldn't need to worry about that either because the two people > coming in would have different values for the $link variable and since > mysql_insert_id goes off of the link identifier of the connection (which will be > different for the two different people running queries), you should not have a > conflict. My worry comes from the fact that I'm running an internal mySQL function and I'm not certain that mySQL would know who was who and which insert ID to return for 2 simultaneous queries. But now that I think about it, I see that worry is misplaced. Chris

« previous php.general (#36496) next »