ช่วยด้วยคับ มันผิดตรงไหนคับStrict Standards: Only variables should be passed by reference in C:\AppServ\www\Nikeshop\add1_product.php on line 35
Code
Strict Standards: Only variables should be passed by reference in C:\AppServ\www\Nikeshop\add1_product.php on line 35
โค๊ดคับ
Code (PHP)
$sql = "insert into prduct (pro_id, pro_name,pro_detail, pro_price, pro_image) values ('', '$name', '$detail', $price, '')";
mysql_query($sql, $conn)
or die ("ไม่สามารถเพิ่มข้อมูลสินค้าใหม่ได้<br>" . mysql_error());
$sqlmax = "select max(pro_id) from prduct";
$ex = mysql_query($sqlmax, $conn);
$row = mysql_fetch_row($ex);
$filename = $pic["name"];
$filetemp = $pic["tmp_name"];
$ext = strtolower(end(explode('.',$filename))); <=บรรทัดที่ผิดคับ
$filename = $row[0] . "." . $ext;
copy($filetemp, "image/".$filename);
$sql_updare = "update prduct set pro_image='$filename' where pro_id=$row[0]";
mysql_query($sql_updare, $conn);
mysql_close($conn);
include "admin_menu.php";
echo "<center><h1>ทำการเพิ่มข้อมูลสินค้าใหม่เรียบร้อยแล้ว</h1></center>";
Tag : PHP, MySQL
Date :
2011-09-27 16:40:14
By :
Theendaof
View :
949
Reply :
4
ช่วยหน่อยคับผมจะส่งแล้ว
Date :
2011-09-27 17:33:58
By :
Theendaof
Code (PHP)
$filename = 'mypic.gif';
// 1. The "explode/end" approach
$ext = end(explode('.', $filename));
// 2. The "strrchr" approach
$ext = substr(strrchr($filename, '.'), 1);
// 3. The "strrpos" approach
$ext = substr($filename, strrpos($filename, '.') + 1);
// 4. The "preg_replace" approach
$ext = preg_replace('/^.*\.([^.]+)$/D', '$1', $filename);
// 5. The "never use this" approach
// From: http://php.about.com/od/finishedphp1/qt/file_ext_PHP.htm
$exts = split("[/\\.]", $filename);
$n = count($exts)-1;
$ext = $exts[$n];
ลองดูครับ
Date :
2011-09-27 17:41:18
By :
webmaster
ขอบคุณคับพี่วิน
Date :
2011-09-27 17:56:17
By :
Theendaof
Load balance : Server 03