Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > ขึ้น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



 

ขึ้น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

 



Topic : 094821



โพสกระทู้ ( 54 )
บทความ ( 0 )



สถานะออฟไลน์




Code
<?php
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"];
$sql_edit="update videoreview set status=$status where vid=$id";
mysql_query($sql_edit) or die (mysql_error());
}
else
{
echo"ไม่สามารถอัปเดตสถานะของวีดีโอได้";
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>ApprovedVideo</title>
</head>
<body bgcolor="#CCCCCC"font-size="16px">
<Form method="post" action="">
<center><div style="background-color:#F5F9FD;height:Auto;width:80%;text-align:left; ">
<center><div div style="background-color:#FAFAD2;height:Auto;width:95%;text-align:left; ">
<h2 style="margin-bottom:0;"><font color="#00BFFF">ApprovedVideo</font></h2>

<?php

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");
$sql_result = mysql_query("SELECT * FROM videoreview WHERE status ='1' order by vid asc");
$path_img = "img/";
$path_vdo = "video/";
while ($result = mysql_fetch_array($sql_result))
{
echo"<tr>";
echo"<td>";
if($result["review_img_path"]!="")
{
echo"<img style='width:70px; height:100px;' src='".$path_img . $result["review_img_path"]."'>";
}
elseif($result["review_img_path"]== null)
{
echo"<img style='width:70px; height:100px;' src='img/img.jpg'>";
}
echo"</td>";
echo"<td>";
echo"ID".$result["vid"]. "ชื่อ " . $result["review_name"] . "";
echo"</td>";
echo"<br>";
echo"</tr>";
echo"<tr>";
echo"<td>";
echo"Title " . $result["comment"] . "";
echo"</td>";
echo"<br>";
echo"</tr>";
echo"<tr>";
echo"<td>";
if ($result["video_type"] == "y")
{
echo"<embed src='http://www.youtube.com/embed/".$result["video_url"]."?fs=1&hl=en_US&rel=0'type='application/x-shockwave-flash'
width='560' height='315' allowscriptaccess='always' allowfullscreen='true'
pluginspage='http://www.adobe.com/go/getflashplayer'></embed>";
}
elseif ($result["video_type"] == "u")
// echo "u";
{
$vdo= $path_vdo.$result["video_path"];
echo"<video width='560' heigth='315' controls>
<source src='$vdo' type='video/mp4'/>
<object data='$vdo' width='560' heigth='315'>
<embed width='560' heigth='315' src='$vdo'>
</object> </video>";
}
echo"</td>";
echo"</tr>";
echo"<a href=edit_status.php?edit_status=".$result["vid"].">อนุมัติ</a><input type='submit' value='Delete'>";
echo"<br>";
}
?>

</div></center>
</div></center>
</form>
</body>
</html>
<?php
mysql_close();
?>




Tag : PHP







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2013-05-07 15:28:04 By : Ryo View : 787 Reply : 10
 

 

No. 1



โพสกระทู้ ( 11,835 )
บทความ ( 10 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

สถานะออฟไลน์


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
 


 

No. 2



โพสกระทู้ ( 54 )
บทความ ( 0 )



สถานะออฟไลน์


ลองเปลี่ยน
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
 

 

No. 3



โพสกระทู้ ( 11,835 )
บทความ ( 10 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

สถานะออฟไลน์


ผมแนะนำให้เปลี่ยนจาก $_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
 


 

No. 4



โพสกระทู้ ( 54 )
บทความ ( 0 )



สถานะออฟไลน์


ไม่ขึ้นerrorอารัยแล้วค่ะแต่มันไม่อัปเดตสถานะเป็น2อ่ะค่ะหนูไม่แน่ใจว่าผิดมันตรงคำสั่งอัปเดตรึป่าวค่ะ


ประวัติการแก้ไข
2013-05-07 16:17:53
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-05-07 16:17:31 By : Ryo
 


 

No. 5



โพสกระทู้ ( 11,835 )
บทความ ( 10 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

สถานะออฟไลน์


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
 


 

No. 6



โพสกระทู้ ( 54 )
บทความ ( 0 )



สถานะออฟไลน์


echoออกมาแล้วได้ update videoreview set vdo_status=2 where vid ='อนุมัติ'
Codeหน้านี้เป็นหน้าที่เรียกข้อมูลที่จะแก้ไขไปโชว์แล้วให้กดsubmitทำการแก้ไข้กลับมาที่หน้าที่ให้โค้ดไปตอนแรกค่ะ

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Login</title>
</head>
<body bgcolor="#CCCCCC"font-size="16px">
<Form method="post" action="approved.php">
<center><div style="background-color:#F5F9FD;height:650px;width:80%;text-align:left; ">
<center><div div style="background-color:#FAFAD2;height:650px;width:95%;text-align:Left; ">
<br>
<br>
<h2 style="margin-bottom:0;"><font color="#00BFFF">EditStatus</font></h2>
<?php

if($_REQUEST['edit_status'] != "")
{
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");
$id = $_REQUEST['edit_status'];
$sql_show = "select * from videoreview where vid = '$id'";
$result_show = mysql_query($sql_show) or die(mysql_error());
$result = mysql_fetch_array($result_show);
$path_img = "img/";
$path_vdo = "video/";
echo"<tr>";
echo"<td>";
if($result["review_img_path"]!="")
{
echo"<img style='width:70px; height:100px;' src='".$path_img . $result["review_img_path"]."'>";
}
elseif($result["review_img_path"]== null)
{
echo"<img style='width:70px; height:100px;' src='img/img.jpg'>";
}
echo"</td>";
echo"<td>";
echo"ID".$result["vid"]. "ชื่อ " . $result["review_name"] . "";
echo"</td>";
echo"<br>";
echo"</tr>";
echo"<tr>";
echo"<td>";
echo"Title " . $result["comment"] . "";
echo"</td>";
echo"<br>";
echo"</tr>";
echo"<tr>";
echo"<td>";
if ($result["video_type"] == "y")
{
echo"<embed src='http://www.youtube.com/embed/".$result["video_url"]."?fs=1&hl=en_US&rel=0'type='application/x-shockwave-flash'
width='560' height='315' allowscriptaccess='always' allowfullscreen='true'
pluginspage='http://www.adobe.com/go/getflashplayer'></embed>";
}
elseif ($result["video_type"] == "u")
// echo "u";
{
$vdo= $path_vdo.$result["video_path"];
echo"<video width='560' heigth='315' controls>
<source src='$vdo' type='video/mp4'/>
<object data='$vdo' width='560' heigth='315'>
<embed width='560' heigth='315' src='$vdo'>
</object> </video>";
}
echo"</td>";
echo"</tr>";
echo"<input type='submit' value='อนุมัติ' name='edit_status'>";
echo"<br>";
}

?>

</div></center>
</div></center>
</form>
</body>
</html>
<?php
mysql_close();
?>

รบกวนหน่อยนะค่ะหนูพึ่งหัดเขียนค่ะ


ประวัติการแก้ไข
2013-05-07 16:53:44
2013-05-07 16:54:28
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-05-07 16:53:09 By : Ryo
 


 

No. 7



โพสกระทู้ ( 11,835 )
บทความ ( 10 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

สถานะออฟไลน์


update videoreview set vdo_status=2 where vid ='อนุมัติ'

น่าจะผิดแล้วหละครับ ตรวจดูดีๆ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-05-07 17:10:33 By : ikikkok
 


 

No. 8



โพสกระทู้ ( 54 )
บทความ ( 0 )



สถานะออฟไลน์


พอเปลี่ยนบรรทัดนี้Code
update videoreview set vdo_status=2 where vid ='Approved'

ก้อechoออกมาเป็นแบบนี้ update videoreview set vdo_status=2 where vid ='Approved'
หนูคิดว่ามันผิดตรงนี้แต่ทำไมถึงเอาค่า vid มาจากบรรทัดนี้อ่ะค่ะCode
update videoreview set vdo_status=2 where vid ='Approved'



ประวัติการแก้ไข
2013-05-07 17:27:08
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-05-07 17:26:20 By : Ryo
 


 

No. 9



โพสกระทู้ ( 11,835 )
บทความ ( 10 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

สถานะออฟไลน์


vid ='Approved' มันจะใช่หรอครับ

$id = $_REQUEST['edit_status']; แก้ id ตรงนี้ให้ตรงกับ id จริงๆ ซะ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-05-07 17:27:51 By : ikikkok
 


 

No. 10



โพสกระทู้ ( 54 )
บทความ ( 0 )



สถานะออฟไลน์


$id = $_REQUEST['vid'];แก้แบบนี้ถูกไหมค่ะ
ถ้าแก้แบบนี้ถูกกดปุ่มsubmitแล้วมันไม่ดึงข้อมูลออกมาโชว์เพื่อที่จะแก้ไขค่ะ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-05-07 17:37:10 By : Ryo
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ขึ้น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
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 04
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่