Hello,
I have a form with multiple lines that is inserting data into multiple tables, and have created the following
Insert Statements to handle the form.
//I connect to the DB then insert the data from the form//
$sql1="INSERT INTO table_1 (Quote_ID, Quote_NO, ect....)
VALUES ('', $quote, ect...')";
$sql2="INSERT INTO table_2 (REQ_NO, Quote_NO, ect....)
VALUES ('', $quote, ect...')";
mysql_query($sql1)
mysql_query($sql2)
//Now if there are more than one line submitted I created something like this//
for($i=1;$i<7;$i++) {
if($POST['quote'.$i] AND ($POST['quote.$i])) {
$quote= $POST[$quote.$i]);
$something = $POST['something'.$i]);
ect..............
$sql3="INSERT INTO table_1 (Quote_ID, Quote_NO, ect....)
VALUES ('', $quote, ect...')";
$sql4="INSERT INTO table_2 (REQ_NO, Quote_NO, ect....)
VALUES ('', $quote, ect...')";
mysql_query($sql3)
mysql_query($sql4)
}
//Then on another page I connect to the db and select the data entered and end up with duplicate resulte. Ie.. if 2 lines were inserted then 4 results would display, 3 lines were inserted then 9 results displays. ect....//
$sql="SELECT table_1.Quote_NO, something, ect...
FROM table_1 INNER JOIN table_2
ON table_1.Quote_NO = table_2.Quote_NO
ORDER BY Quote_NO, something, ect...";
It seems like there is a Cartesian Join or Cross join going on???
Please help me out here??
Thx,
015653