this is my include file::
Code: Select all
<?php
$mydb=mysql_connect("localhost", "xxx", "xxx");
mysql_select_db("xxx", $mydb);
$sql2="SELECT * FROM _products WHERE ILCProductID = '$ILCProductID'";
$result2 = mysql_query($sql2);
echo mysql_error();
if (mysql_num_rows($result2) == 0) {
$sql3="INSERT INTO _products (ILCProductID, Title, Authors, ISBN, ILCRetailPrice, CompanyName, ProductType, MediaType, ShipWeight, InInventory, OldilcID) VALUES ('$ILCProductID', '$Title', '$Authors', '$ISBN', '$ILCRetailPrice', '$CompanyName', '$ProductType', '$MediaType', '$ShipWeight', '$InInventory', '$OldIlcID')";
$result3 = mysql_query($sql3);
echo mysql_error();
}
else {
// update rows with existing rows
$sql4="UPDATE _products SET Title = '$Title', Authors = '$Authors', ISBN = '$ISBN', ILCRetailPrice = '$ILCRetailPrice', CompanyName = '$CompanyName', ProductType = '$ProductType', MediaType = '$MediaType', ShipWeight = '$ShipWeight', InInventory = '$InInventory', OldIlcID = '$OldIlcID' WHERE ILCProductID = '$ILCProductID'";
$result4 = mysql_query($sql4);
echo mysql_error();
}
?>