PHP and getting last insert AUTO_INCREMENT values

Sic

Sic

Soldato
Joined
9 Nov 2004
Posts
15,365
Location
SO16
OK, I have to ask. I've always found a way around this, like manually generating keys, but it's a pain if it's unnecessary so I must ask. Are the last insert id functions reliable? I'm writing for a very high traffic site, and I'm concerned that the insert id functions might get wires crossed. I realise that there would have to be a LOT of traffic for this, but I'd rather be sure. Seeing as these functions work off the connection identifier, do they return the value last inserted by this connection, or just the last value?

Also, for any Captain Obvious people, I realise that it must be used directly after the query, and that update and select influence some of them.

I'm also looking for definite answers, not "it should do", or "I think so".
 
Thanks Beansprout - that's what I'd hoped.

It's not that I'm worried about losing track of the resource, just that what the resource gives me could be useless. All the insert id stuff is done by the framework I'm using, I just wanted to make sure that it was safe to use.

Thanks guys.
 
Back
Top Bottom