Warning: mysql_fetch_array():
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重复了.
您可能感兴趣的文章:
Warning: mysql_fetch_array():
php 提示Warning: mysql_fetch_array() expects
Warning: mysql_fetch_assoc() expects parameter 1 to be resource解决方法
php中mysql_fetch_array()和mysql_fetch_rows()函数区别
php中mysql_fetch_array()函数的用法
php不显示warning方法
Warning: session_start() [function.session-start]: open_basedir restriction in effect. File解决方法
Warning: session_start() [function.session-start]: Cannot send session cookie解决办法
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move
Warning: mysql_free_result():