ช่วยดูโค้ดphp ให้ด้วยคร๊า error แก้ไม่ได้ตาลายๆๆ ไม่รู้ว่าผิดอย่างไรคร๊า
Code (PHP)
<?php
session_start();
if(empty($_SESSION[user_admin])){
echo " <center><h3> คุณเข้าสู่ระบบไม่ถูกต้อง กรุณาล็อกอินเข้าสู่ระบบ</center></h3>";
echo"<center><a href=index.php><h3>..click..</h3></a></center>";
exit;
}
$id_edit=$_POST[id_edit];
$pro_name=$_POST[pro_name];
$c_id=$_POST['c_id'];
$b_id=$_POST['b_id'];
$pro_detail=$_POST['pro_detail'];
$pro_price=$_POST['pro_price'];
$pro_stock=$_POST['pro_stock'];
$prop_id=$_POST['prop_id'];
$pro_use=$_POST['pro_use'];
$date1=$_POST['date1'];
$date2=$_POST['date2'];
$pro_photo=$_POST['pro_photo'];
$fileupload=$_FILES['fileupload']['tmp_name'];
$fileupload_name=$_FILES['fileupload']['name'];
$fileupload_size=$_FILES['fileupload']['size'];
$fileupload_type=$_FILES['fileupload']['type'];
include(".../config.inc.php");
if($chkdel=="1"){
$sql3="update product set pro_photo='' where pro_id ='$id_edit' ";
$result3=mysql_db_query($db,$sql3);
unlink ("../photo_pro/$photo_del");
}
if($fileupload){
$array_last=explode(".",$fileupload_name);
$c=count($array_last)-1;
$lastname=strtolower($array_last[$c]);
if($lastname=="gif" or $lastname=="jpg" or $lastname=="jpeg"){
$photoname=$id_edit.".".$lastname;
copy($fileupload,"../photo_pro/".$photoname);
$sql3="update product set pro_photo='$photoname' where pro_id ='$id_edit'";
$result3=mysql_db_query($db,$sql3);
}
unlink($fileupload);
}
$sql="update product set
pro_name='$pro_name',
c_id='$c_id',
b_id='$b_id',
pro_detail='$pro_detail',
prop_id='$prop_id',
pro_use='$pro_use',
pro_mfd_date='$date1',
pro_exp_date='$date2',
pro_price='$pro_price',
pro_stock='$pro_stock',
where pro_id='$id_edit'";
$result=mysql_db_query($db,$sql) or die(mysql_error());
if($result){
echo"<meta http-equiv='refresh' content='0;url=status_product.php'>";
}else{
echo"<meta http-equiv='refresh' content='0;url=status_product_error.php'>";
}
mysql_close();
?>
ฟ้อง 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 'where pro_id='1'' at line 12
Tag : PHP
Date :
2013-05-13 01:18:15
By :
jar0274
View :
697
Reply :
3
echo $sql3 มาดูหน่อยครับว่ามันถูกต้องไหม
Date :
2013-05-13 03:21:52
By :
dekkuza
ขอบคุณนะคะ คุณ TC Admin
Date :
2013-05-13 09:07:05
By :
jar0274
Load balance : Server 04