 |
ช่วยดู Error ให้หน่อยครับ ผมหาข้อผิดพลาดจาก คิวรี่ ไม่เจอ ช่วยหน่อยนะครับ |
|
 |
|
|
 |
 |
|
code ครับ
Code (PHP)
<?php
// ทำการรับค่าจาก $_POST ที่ส่งมาจากฟอร์มนั้น ๆ
$Cus_ID = $_POST['Cus_ID'];
$Cloth = $_POST['Cloth'];
$Detail = $_POST['Detail'];
// เมื่อเราได้ค่าจากฟอร์มที่ส่งมาเรียบร้อยแล้ว ให้เราทำการบันทึกข้อมูลเข้าไปทันที โดยก่อนอื่นจะต้องเชื่อมต่อกับฐานข้อมูลก่อนครับ
mysql_connect("localhost", "root", "root");
mysql_select_db("Laundry");
mysql_query("SET NAMES tis620");
$sqlAdd = "INSERT INTO blame (Blame_ID, Cus_ID, Cloth, Detail,) VALUES ('', '$Cus_ID', '$Cloth', '$Detail')";
mysql_query($sqlAdd) or die("Query failed ($query) - " . mysql_error());
if($sqlAdd)
{
echo $sqlAdd;
header("location: EmpChekBlame.php");
}
mysql_close();
?>
Tag : PHP, MySQL, HTML/CSS, JavaScript, CakePHP
|
|
 |
 |
 |
 |
Date :
2012-02-21 22:20:20 |
By :
Dongonline |
View :
1160 |
Reply :
6 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Error แบบนี้ครับ
Query failed () - 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 ') VALUES ('', '4', '4', '4')' at line 1
|
 |
 |
 |
 |
Date :
2012-02-21 22:20:51 |
By :
Dongonline |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
echo $sqlAdd;
header("location: EmpChekBlame.php");
header ห้ามมี echo ด้านบนครับ และบนโค้ด php ก็ห้ามเคาะ enter หรือตัวอักษรใด
ถ้าอยากให้แสดงข้อความใดๆ ลองใช้ java
if($sqlAdd)
{
echo("<script> alert('$sqlAdd'); window.location='EmpChekBlame.php';</script>");
}
รอผู้เชียวชาญมาคอนเฟิร์มอีกที
|
 |
 |
 |
 |
Date :
2012-02-21 22:33:36 |
By :
tonkonk |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ครับ จะลองดูครับ
|
 |
 |
 |
 |
Date :
2012-02-21 22:36:04 |
By :
Dongonline |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ยังไม่ได้ครับ
|
 |
 |
 |
 |
Date :
2012-02-21 22:40:06 |
By :
Dongonline |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
INSERT INTO blame (Blame_ID, Cus_ID, Cloth, Detail,) VALUES
|
 |
 |
 |
 |
Date :
2012-02-21 22:55:59 |
By :
ikikkok |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณครับ สงสัยสายตาผมจะไม่ดี
|
 |
 |
 |
 |
Date :
2012-02-21 22:58:01 |
By :
Dongonline |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|