Re: Table locking

From: Date: Sat, 10 Jul 2004 23:06:12 +0000
Subject: Re: Table locking
References: 1 2 3 4 5 6 7 8 9  Groups: php.db 
Request: Send a blank email to php-db+get-35189@lists.php.net to get a copy of this message
In article <20040710224619.99288.qmail@pb1.pair.com>, Rosen wrote: > I have an orders with one main record in table1 ( client, date, e.t.c. ) and > detail description in table2 ( all materials with quant, price, e.t.c. ) > and I save data in table1 for positions (range of id - autoinc field of > records in table2) for detailed data of order . And I don't want someone > else to insert data in table2, because will be a problem with orders. > Now I insert data first in table2 and then insert main record in table1 with > the range of id's of detail order data. If you are using mysql you'll want to lookup what LAST_INSERT_ID can do for you ;) I don't really know your situation, but usually there are many clients and many products. If you want to represent this type of relation in a rdbms you'll have to use a link table (let's call it sales) that allows you to have 1-n relationships between clients-sales and products-sales. Apart from the links to the client_id and the product_id, you also may want to have a sales_id, quantity, date of order, ... -- Tim Van Wassenhove <http://home.mysth.be/~timvw>

« previous php.db (#35189) next »