[thelist] MySQL generated id

noah noah at tookish.net
Thu Sep 20 13:37:56 CDT 2001

Apologies if this is a dumb question . . .

When I insert a new record into a MySQL table (via PHP), I use MySQL's 
auto-increment to create a unique id number for that record. What I'd like 
to do is immediately have access to the id number in PHP. I could use a 
separate select statement, but since I don't know the unique id, I run the 
risk of returning multiple records, rather than just the one I just inserted.

Is there anyway to immediately have access to the id number generated when 
the record is inserted?

Thanks very much,

More information about the thelist mailing list