HOME > PHP > PHP Forum > Warning: mysql_fetch_array(): เป็นที่อะไรครับ Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in 'xxxx'
Warning: mysql_fetch_array(): เป็นที่อะไรครับ Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in 'xxxx'
if ($title=="" or $detail=="" or $type=="0") {
echo "<h2> ¡ÃسҡÃÍ¡¢éÍÁÙÅãËé¤Ãº </h2>";
exit();
}
include "connect.php";
$sql="INSERT INTO tb_new
VALUES(null,'$title','$detail','$type','','$date_today','$time_today')";
mysql_db_query("$dbname",$sql);
$ext = strtolower(end(explode('.', $photo_name)));
if ($ext == "jpg" or $ext == "jpeg" or $ext == "png" or
$ext =="gif") {
$sql="select max(id_new) from tb_new";
$result=mysql_db_query($dbname,$sql);
$r=mysql_fetch_array($result);
$id_max=$r[0];
$sql="update tb_new set photo_new='$filename' where
id_new='$id_max' ";
mysql_db_query($dbname,$sql);
}
echo "<h3>à¾ÔèÁ¢éÍÁÙÅàÃÕºÃéÍÂáÅéǤèÐ</h3>";
echo "[ <A HREF=new_main.php>¡ÅѺä»Ë¹éÒËÅÑ¡</A> ]";
mysql_close();
?>
รันแล้วมันฟ้องว่า
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\test\new_add2.php on line 36
Warning: copy(photo/ . png) [function.copy]: failed to open stream: No such file or directory in C:\AppServ\www\test\new_add2.php on line 40
เพิ่มข้อมูลเรียบร้อยแล้วค่ะ