Re: Inserting records across multiple mySQL forms - tracking ID's?

From: Date: Sat, 06 Jul 2002 06:24:07 +0000
Subject: Re: Inserting records across multiple mySQL forms - tracking ID's?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-20353@lists.php.net to get a copy of this message
On Saturday 06 July 2002 08:18, Matthew Nock wrote: > I want to create a form that will input a number of records, into a number > of different tables. > > The first part of the detail will need to create a new "product" record. > this will create Product ID. the Product ID is required to insert the > "features" for this product ID into another table. > > Is there any way that run determine the ProdID of the record I am > inserting, so that I can run the insert for the features? If ProdID is an autoincrement field (and if it isn't you really should make it so), then use mysql_insert_id(). > or am I going to need to Insert the Product record (to get the Product ID), > and then query the product database, to get the new ID, then use the newly > gained ID, to add all the features to the feature table? That's what you'll have to do if ProdID is not an autoincrement field. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Someone's tie is caught in the printer, and if anything else gets printed, he'll be in it too. */

« previous php.db (#20353) next »