[thelist] Sessions in PHP4
Katherine Spice
k.spice at acu.ac.uk
Tue Jul 25 11:26:17 CDT 2000
Liz Lawson wrote:
> (I don't want to use an autonumber column because I need to do inserts over
> a few tables, so I want to know the PK before I insert any data to get
> around mysql's lack of transactions...)
>
if it's just you doing the inserts, and you don't intend to scale this
up, mysql offers a LAST_INSERT_ID function (as in SELECT LAST_INSERT_ID
FROM table_whatever), which returns the last value automatically
generated for an AUTO_INCREMENT field, so you could retrieve the primary
key for the first insert that way.
maybe as a last resort.
Katherine
More information about the thelist
mailing list