I've been using mysql\_pconnect to establish all DB connections on my PHP site, with the theory that it's more efficient (debatable, I know).

I went to use mysql\_insert\_id to get the ID from a recent INSERT and it occurred to me that given the multi-threaded nature of web requests, I can't guarantee that another PHP script using the same pconnection has made a DB INSERT before my call to mysql\_insert\_id.

This is kind of a huge deal as I see no other way to guarantee atomicity of the INSERT and ID retrieval, as the ID is not returned by the INSERT query (or I don't know how to get it).

So basically I can never use mysql\_pconnect if I want to have thread-safe INSERTS and ID retrieval?