ช่วยดูให้หน่อยครับโค้ดผมผิดส่วนไหน You have an error in your SQL syntax; check the manual that corresponds to your M
Code
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'order (OrderDate,Name,Address,Tel,Email) VALUES ('2018-10-08 20:29:05','',''' at line 1
ส่วนตัวโค้ดผมน้ำมาจากเว็บมทั้งหมดเลยเปลียนนิดหน่อย
Code (PHP)
<?php
session_start();
mysql_connect("localhost","root","123456");
mysql_select_db("project");
$Total = 0;
$SumTotal = 0;
$strSQL = "
INSERT INTO order (OrderDate,Name,Address,Tel,Email)
VALUES
('".date("Y-m-d H:i:s")."','".$_POST["txtName"]."','".$_POST["txtAddress"]."' ,'".$_POST["txtTel"]."','".$_POST["txtEmail"]."')
";
mysql_query($strSQL) or die(mysql_error());
$strOrderID = mysql_insert_id();
for($i=0;$i<=(int)$_SESSION["intLine"];$i++)
{
if($_SESSION["strProductID"][$i] != "")
{
$strSQL = "
INSERT INTO orders_detail (OrderID,ProductID,Qty)
VALUES
('".$strOrderID."','".$_SESSION["strProductID"][$i]."','".$_SESSION["strQty"][$i]."')
";
mysql_query($strSQL) or die(mysql_error());
}
}
mysql_close();
session_destroy();
header("location:finish_order.php?OrderID=".$strOrderID);
?>
Tag : PHP
Date :
2018-10-09 01:36:19
By :
1082842008553424
View :
729
Reply :
1
Load balance : Server 01