mysql 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 ')'
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 ')' at line 1
ชี้แนะด้วยนะค่ะ
ตาราง `order_bill`
`order_id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
`order_name`VARCHAR( 50 )
`shipping_address` VARCHAR( 255 )
ตาราง order_detail
`detail_id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
`order_id` INT( 11 ) NOT NULL ,
`pro_id` VARCHAR( 10 )
Cod
(PHP)
session_start();
$address = $_REQUEST["address"];
$roder_name = $_REQUEST["order_name"];
$cart = $_SESSION["cart"];
$order_date = date("d/m/y");
$error = "";
include('config.inc.php');
if($address =="")
{
$error .= "คุณไม่ได้ระบุข้อมูล";
}
if($error =="")
{
$sql = "INSERT INTO order_bill (shipping_address,order_name,order_date) values ('$address','$order_name',$order_date)";
$db_query = mysql_db_query($db_name,$sql);
echo $sql;
foreach ($cart as $pro_id => $item)
{
$sql_detail = "INSERT INTO order_detail (amount_pro,pro_id,order_id) values ($item[amount],$pro_id,$order_id)";
$db_query_detail = mysql_db_query($db_name,$sql_detail) or die (mysql_error());
}
unset($_SESSION["cart"]);
}
if($error =="")
{
$result = "ยืนยันการสั่งซื้อเรียบร้อย"."<a href = 'show_procudt.php'>สั่งซื้อใหม่</a>"
."<a href = '#' onclick = 'history.back();"
."return false;'>กลับไป</a>";
}
?>
Tag : - - - -
Date :
2010-07-06 15:53:21
By :
girl.tear
View :
1504
Reply :
3
เพิ่มเติมอีกนิดนะค่ะ
ลอง echo $sql_detail ดู order_id ไม่ขึ้นอะค่ะ
Date :
2010-07-06 16:28:22
By :
girl.tear
ได้แล้ว ค่ะ ขอบคุณมากค่ะ พี่วิน
Date :
2010-07-06 19:40:57
By :
girl.tear
Load balance : Server 02