[thelist] Sql muti table insert needing auto increment value

Anthony Baratta Anthony at Baratta.com
Fri Aug 8 13:13:03 CDT 2003

At 10:40 AM 8/8/2003, fstorr wrote:
>Hi all
>I need to do a SQL insert statement into three tables.  However, the
>second table contains a column which is a foreign key to the first
>table's auto incrementing index.  How do I insert this value into the
>second table (I'm using PHP+MySQL) when I don't actually know what it

Insert into first table and then get the ID added by the DB Engine for use 
with the other inserts.


Anthony Baratta
Keyboard Jockeys

"Conformity is the refuge of the unimaginative."

More information about the thelist mailing list