[thelist] SELECTing and auto_increment field

Joshua Olson joshua at alphashop.net
Thu Sep 13 17:13:56 CDT 2001

If the database supports single threading, then you can put it into single
thread mode, do the insert, do a select max on the id, and carry one.
Otherwise, some of the possible approached may depend on your middleware if
you .  What are you using?  PHP?  CF?  ASP?  etc

A common technique is to put the middleware in single thread mode, generate
a UID based of the time, return from single threaded mode, and use the UID
in the insert and subsequent select.  Then you have the id off the record
and you can discard the UID.


----- Original Message -----
From: "Andrew Forsberg" <andrew at thepander.co.nz>
Subject: [thelist] SELECTing and auto_increment field

: Hi all
: There's got to be a really simple solution that I'm overlooking here.
: I'd like to know what the auto_incremented field of an insert into a
: mysql table is, but preferably without having to run a hokey select
: after the insert. At the moment I'm doing this:

More information about the thelist mailing list