 |
ช่วยแก้ปัญหาทีครับ You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax |
|
 |
|
|
 |
 |
|
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' ('order_date','cus_id','order_add') VALUES ('2013-09-02'
แก้ยังไงดีครับ บอกหน่อย
Code (PHP)
<?
session_start();
include("connect_db.php");
$Total = 0;
$SumTotal = 0;
$cu_id=$_REQUEST['cusid'];
$or_add=$_REQUEST['txtAddress'];
$sql = "INSERT INTO order ";
$sql = $sql."(order_date,cus_id,order_add) ";
$sql = $sql."VALUES ('".date("Y-m-d")."',\"".$cu_id."\",\"".$or_add."\") ";
$result = mysql_query($sql) or die(mysql_error() . "<br />" . $sql);
$strOrderID = mysql_insert_id();
for($i=0;$i<=(int)$_SESSION["intLine"];$i++)
{
if($_SESSION["strProductID"][$i] != "")
{
$strSQL = "
INSERT INTO order_detail (order_id,prd_id,order_amount)
VALUES
('".$strOrderID."','".$_SESSION["strProductID"][$i]."','".$_SESSION["strQty"][$i]."') ";
mysql_query($strSQL) or die(mysql_error());
}
}
mysql_close();
session_destroy();
header("location:finish_order.php?order_id=".$strOrderID);
?>
Tag : PHP, MySQL
|
|
 |
 |
 |
 |
Date :
2013-09-02 00:40:48 |
By :
Anonymous |
View :
904 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
$sql คงจะไม่ถูกต้องตรงไหนสักที่
|
 |
 |
 |
 |
Date :
2013-09-02 01:33:55 |
By :
{Cyberman} |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ปัญหานี้ไม่น่าเกิดขึ้นนะ การตั้งชื่อฟิลด์ ชื่อเทเบิ้ล ไม่ควรใช้คำสงวนหรือภาษาไทยในการตั้ง
|
 |
 |
 |
 |
Date :
2013-09-02 03:37:29 |
By :
PlaKriM |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|