>  기사  >  백엔드 개발  >  Warning: mysql_fetch_array():_PHP教程

Warning: mysql_fetch_array():_PHP教程

WBOY
WBOY원래의
2016-07-13 10:52:27789검색

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으로 문의하세요.