Something is going on with my MySQL Input statement. Sometimes is works, other times not. I confirmed the variables are being passed from the form, but I can’t figure out what’s going on. Any help would be appreciated. Thanks.
<?PHP
$cust_id = $_POST[“cust_id”]; $fname = $_POST[“lname”]; $address = $_POST[“city”]; $state = $
$item = $_POST[“item”]; $descr = $_POST[“quantity”]; $price = $
echo “$cust_id, $fname, $lname, $address, $city, $state, $zip”;
$link = mysql_connect(“localhost”, “rr_steve”, “2222”) or die (“Access To DB Error”);
mysql_select_db(“rr_test”, $link) or die (“DB not selected”);
$gen=”INSERT INTO general (ID, FName, LName, Address, City, State) VALUES (‘$cust_id’,’$fname’,’$lname’,’$address’,’$city’,’$state’)”;
mysql_query($gen) or die (“general table Data Not Entered”);
$pur=”INSERT INTO Purchasing (ID, Item, Description, Quantity, Price, Comments) VALUES (‘$cust_id’,’$item’,’$descr’,’$quantity’,’$price’,’$comments’)”;
mysql_query($pur) or die (“Purchasing Data Not Entered”);
echo “<div align=center><h2>Customer Data Entered Successfully</h2></div>”;
?>