|
 |
|
ตรวจให้หน่อยนะว่ามันผิดตรงไหน อ่ะค่ะ ส่งอาจานด้วย ช่วยหน่อยนะค่ะ |
|
 |
|
|
 |
 |
|
ดูให้หน่อยค่ะว่าผิดตรงไหนอ่ะ
<?
session_start();
if($sess_adminid<>session_id()) {
header( "Location:admin.php"); exit();
}
$name=$_POST[name];
$ref_id_type=$_POST[ref_id_type];
$detail=$_POST[detail];
$price=$_POST[price];
$fileupload=$_FILES['fileupload']['tmp_name'];
$fileupload_name=$_FILES['fileupload']['name'];
$fileupload_size=$_FILES['fileupload']['sizs'];
$fileupload_type=$_FILES['fileupload'][type'];
if($name=="") {
echo "<h3>Error : กรุณากรอกชื่อสินค้า</h3>";
exit();
} else if ($ret_id_type=="O") {
echo"<h3>Error : กรุณาเลือกประเภทสินค้า</h3>";
exit();
} else if ($detail=="") {
echo "<h3>Error : กรุณากรอกรายละเอียด</h3>";
exit();
} else if ($price=="") {
echo "<h3>Error : กรุณากรอกราคาสินค้า</h3>";
exit();
}
include "connect.php";
$sql = "INSERT INTO tb_product
values (null,'$name','$ref_id_type','$detail','$price',")";
$result=mysql_db_query($dbname,$sql);
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") {
$sql2 = "select max(id_prd) from tb_product ";
$result2 = mysql_db_query($dbname,$sql2);
$row = mysql_fetch_row($result2);
photoname=$row[0].".".$lastname;
copy($fileupload,"Photo/".$Photoname);
$sql3 = "update tb_product set Photo_prd = '$Photoname'
where id_prd = '$row[0]'";
$result3 = mysql_db_query($dbname,$sql3);
}
unlink($fileupload);
}
echo "<h3>เพิ่มสินค้าเรียบร้อยแล้ว</h3>";
echo "[ <a href =admin_product.php>กลับหน้าหลัก</a>]";
mysql_close();
?>
มันเปงโค้ดเพิ่มสินค้าอะจ่ะ
Tag : PHP, MySQL

|
|
 |
 |
 |
 |
Date :
2010-12-21 11:18:24 |
By :
yokuchan |
View :
743 |
Reply :
5 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ให้ดูยังไงครับ มีปัญหาไรยังไงครับไม่เห็นบอกเลย
|
 |
 |
 |
 |
Date :
2010-12-21 11:47:09 |
By :
fresh |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อ่อ พอรันแล้วมันจะขึ้นว่า
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ']' in D:\AppServ\www\admin_product_add2.php on line 29
แต่หาแล้วมันไม่เหงมีอะไรผิดเลยอ่ะค่ะ
|
 |
 |
 |
 |
Date :
2010-12-21 11:48:08 |
By :
yokuchan |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แงๆๆ ช่วยหน่อยนะค่ะ
|
 |
 |
 |
 |
Date :
2010-12-21 12:58:21 |
By :
yokuchan |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
line 29 อันไหนว่า
ลองดู ' กับ " น่าจะผิดอยู่นะคับ
|
ประวัติการแก้ไข 2010-12-21 13:22:42
 |
 |
 |
 |
Date :
2010-12-21 13:17:05 |
By :
EucifeR |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ได้แล้วค่ะ ขอบคุณนะค่ะ
|
 |
 |
 |
 |
Date :
2010-12-21 13:27:58 |
By :
yokuchan |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 00
|