 |
ขึ้น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 |
|
 |
|
|
 |
 |
|
if($_POST['edit_status']!=null)
{
mysql_connect("localhost","root","root")or die("mysql error");
mysql_select_db("videoreview")or die("mysql error");
mysql_query("SET character_set_results=utf8");
mysql_query("SET character_set_client=utf8");
mysql_query("SET character_set_connection=utf8");
$status="2";
$id=$_GET["edit_status"];
|
 |
 |
 |
 |
Date :
2013-05-07 15:30:26 |
By :
ikikkok |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองเปลี่ยน
if($_POST['edit_status']!=null)
{
mysql_connect("localhost","root","root")or die("mysql error");
mysql_select_db("videoreview")or die("mysql error");
mysql_query("SET character_set_results=utf8");
mysql_query("SET character_set_client=utf8");
mysql_query("SET character_set_connection=utf8");
$status="2";
$id=$_POST["edit_status"]
ขึ้นerrorแบบนี้ Unknown column 'à¸à¸™à¸¸à¸¡à¸±à¸•ิ' in 'where clause'อ่ะคะ
|
 |
 |
 |
 |
Date :
2013-05-07 15:51:17 |
By :
Ryo |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมแนะนำให้เปลี่ยนจาก $_POST เป็น $_REQUEST ครับ เพราะดูเหมือนจะมีการส่งทั้งแบบ POST และ GET ใส่ escape string ด้วยจะดีมากครับตอน Excute
$sql_edit="update videoreview set status=$status where vid='$id'";
|
 |
 |
 |
 |
Date :
2013-05-07 16:03:00 |
By :
ikikkok |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไม่ขึ้นerrorอารัยแล้วค่ะแต่มันไม่อัปเดตสถานะเป็น2อ่ะค่ะหนูไม่แน่ใจว่าผิดมันตรงคำสั่งอัปเดตรึป่าวค่ะ
|
ประวัติการแก้ไข 2013-05-07 16:17:53
 |
 |
 |
 |
Date :
2013-05-07 16:17:31 |
By :
Ryo |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
echo $sql_edit="update videoreview set status=$status where vid='$id'";
echo ออกมาดูครับ ดูว่าเข้า if หรือเปล่า แล้วก็ดูว่า statement มันถูกต้องหรือไม่
|
 |
 |
 |
 |
Date :
2013-05-07 16:36:13 |
By :
ikikkok |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
update videoreview set vdo_status=2 where vid ='อนุมัติ'
น่าจะผิดแล้วหละครับ ตรวจดูดีๆ
|
 |
 |
 |
 |
Date :
2013-05-07 17:10:33 |
By :
ikikkok |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
vid ='Approved' มันจะใช่หรอครับ
$id = $_REQUEST['edit_status']; แก้ id ตรงนี้ให้ตรงกับ id จริงๆ ซะ
|
 |
 |
 |
 |
Date :
2013-05-07 17:27:51 |
By :
ikikkok |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
$id = $_REQUEST['vid'];แก้แบบนี้ถูกไหมค่ะ
ถ้าแก้แบบนี้ถูกกดปุ่มsubmitแล้วมันไม่ดึงข้อมูลออกมาโชว์เพื่อที่จะแก้ไขค่ะ
|
 |
 |
 |
 |
Date :
2013-05-07 17:37:10 |
By :
Ryo |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|