Re: Writing to two tables in 1-N relationship.

From: Date: Thu, 20 Sep 2001 11:48:18 +0000
Subject: Re: Writing to two tables in 1-N relationship.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-67976@lists.php.net to get a copy of this message
On Thu, 20 Sep 2001 13:22:03 +0000, you wrote: >I have two DB tables that are in a 1 - N relationship. I need to enter data >once in the 1-side, and then many times data on the N-side. > >(For those who like it less abstract: The 1-side is a table with data about a >car (frame number, brand + type, and a carrier), the N-side has records about >damages found on that car after transport) > >I'm a little bit confused about how to deal with this: >- After every data input, write the stuff away to a temp text file, and when >all input is done, write that text file at once to the database. > >- Store the data in arrays, and pass them on between runs of the script as >part of the URL (but I could run out of space?) If I understand your question correctly, this is typically how it's done. Multi-stage forms pass variables along as <input type="hidden"> fields. Unless you're passing a /lot/ of data, I wouldn't worry about running out of space. Alternative: Create 2 extra tables to store pending data in. When the transaction has been completed, data is copied from your pending tables to your real tables. Not elegant, but it would work. djo

« previous php.general (#67976) next »