This is the code I have
$TypeSQL = "INSERT INTO Type (type) VALUES ('$type')";
$TypeResult = mysql_query($TypeSQL) or die(mysql_error());
$typeid = mysql_insert_id();
$VarietalSQL = "INSERT INTO Varietal (varietal) VALUES ('$varietal')";
$VarietalResult = mysql_query($VarietalSQL) or die(mysql_error());
$varietalid = mysql_insert_id();
$LabelSQL = "INSERT INTO Label (label) VALUES ('$label')";
$LabelResult = mysql_query($LabelSQL) or die(mysql_error());
$labelid = mysql_insert_id();
$ProducerSQL = "INSERT INTO Producer (producer, producerdesc) VALUES ('$producer','$producerdesc')";
$ProducerResult = mysql_query($ProducerSQL) or die(mysql_error());
$producerid = mysql_insert_id();
$RegionSQL = "INSERT INTO Region (region) VALUES ('$region')";
$RegionResult = mysql_query($RegionSQL) or die(mysql_error());
$regionid = mysql_insert_id();
$CountrySQL = "INSERT INTO Country (country) VALUES ('$country')";
$CountryResult = mysql_query($CountrySQL) or die(mysql_error());
$countryid = mysql_insert_id();
$RatingSQL = "INSERT INTO Rating (rating) VALUES ('$rating')";
$RatingResult = mysql_query($RatingSQL) or die(mysql_error());
$ratingid = mysql_insert_id();
$AvailSQL = "INSERT INTO Available (available) VALUES ('$available')";
$AvailResult = mysql_query($AvailSQL) or die(mysql_error());
$availableid = mysql_insert_id();
$CaseSQL = "INSERT INTO CasePrice (caseprice) VALUES ('$caseprice')";
$CaseResult = mysql_query($CaseSQL) or die(mysql_error());
$casepriceid = mysql_insert_id();
$BottleSQL = "INSERT INTO BottlePrice (bottleprice) VALUES ('$bottleprice')";
$BottleResult = mysql_query($BottleSQL) or die(mysql_error());
$bottlepriceid = mysql_insert_id();
$InsertSQL = "INSERT INTO Wine (varietalid, typeid, labelid, producerid,countryid, regionid, ratingid, availableid, casepriceid, bottlepriceid) VALUES ($varietalid, $typeid, $labelid,$countryid, $regionid, $producerid, $ratingid, $availableid, $casepriceid, $bottlepriceid)";
$InsertResult = mysql_query($InsertSQL) or die(mysql_error());
This code is creating two entries in the database. Is this the best way to enter into multiple tables?
If not please show examples
thanks