首頁 >後端開發 >php教程 >Warning: mysql_fetch_array():_PHP教程

Warning: mysql_fetch_array():_PHP教程

WBOY
WBOY原創
2016-07-13 10:52:27839瀏覽

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in

$connect=mysql_connect("localhost","root","123") or die("无法连接数据库".mysql_error());


mysql_select_db("cmstest") or die("无法选择数据库".mysql_errno());


$sql="select * from article where pid=1";
$result=mysql_query($sql,$connect) or die("无法查询sql语句".mysql_error());
$nums=mysql_num_rows($result);
echo "nums is:".$nums;
while($res=mysql_fetch_array($result)){   
echo $res[0]; 
}

原来是$result重复了.

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/632485.htmlTechArticleWarning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in $connect=mysql_connect(localhost,root,123) or die(无法连接数据库.mysql_error()); mysq...
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn