我收到以下错误,无法弄清楚问题所在。
错误:您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以在第 1 行的“订单(订单 ID、客户 ID、产品 ID、品牌、型号、价格、金额、总成本)V”附近使用正确的语法
//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);