[thelist] MySQL Inserts

rudy r937 at interlog.com
Tue Jan 28 18:36:01 CST 2003


> Is this the way to do it?

andrew, it's not clear from your post where the $ItemID value comes from

does the Items table have an auto_increment column?  which column is it?

typically, you allow mysql to assign an auto_increment value when it inserts
a row into a table that has an auto_increment primary key, and then you
retrieve this value using mysql_insert_id(), and then you use this value
when inserting rows that contain a foreign key to the row you just inserted

does that make sense?

alternatively, if you are assigning primary key values yourself, then the
code you posted is probably okay, two inserts using the same value of
$ItemID


rudy




More information about the thelist mailing list