I am getting the following error and can't figure out what the problem is.
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order (orderid, customerid, productid, brand, model, price, amount, totalcost) V' at line 1
//connect to database
$connection = mysql_connect("localhost","root","") or die ("Can't connect");
mysql_select_db("shoppingcart", $connection) or die ("Can't connect");
//get order id
$vol = mysql_query("SELECT orderid FROM ordertracking WHERE email='$email'");
while($volume=mysql_fetch_array($vol)) {
$orderid = $volume['orderid'];
}
echo $orderid;
// add new order
$order = "INSERT INTO order (orderid, customerid, productid, brand, model, price, amount, totalcost) VALUES ('$orderid', '$customerid', '$productid', '$brand' , '$model', '$price', '$amount', '$totalcost')";
if (!mysql_query($order,$connection)) {
die('Error: ' . mysql_error());
echo "Sorry, there was an error";
}
echo "New order added" . "<br />";
mysql_close($connection);