Re: [PHP-DB] Inserting records across multiple mySQL forms - tracking ID's?

2002-07-06 Thread Jason Wong

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.
*/


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Inserting records across multiple mySQL forms - tracking ID's?

2002-07-05 Thread Matthew Nock

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?

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?


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php