Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\My Webs\php\sqlgunnews\common.inc.php on line 这个程序运行,领导提示报错,我找几个朋友运行了,都不报错,求好心人再运行一下,看看你们运行的结果是什么样的。
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\My Webs\php\sqlgunnews\common.inc.php on line 22 说22行有问题。22行真的没有找到问题,就一条记录而已,写法没有什么不妥的地方,字段名都是正确的。求老师给找出问题所在! $_result=mysql_query("select * from system"); if(!!$_rows=mysql_fetch_array($_result)){ //这就是22行 $_system=array(); $_system['name']=$_rows['name']; $_system['pagenums']=$_rows['pagenums']; $_system['newsnums']=$_rows['newsnums']; $_system['hotnums']=$_rows['hotnums']; $_system['copy']=$_rows['copy']; }else{ echoalert('系统配置错误!'); exit; }
第21行 $_result=mysql_query("select * from system") or die(mysql_error());一切都大白于天下
谢谢ycnxz,感谢您的帮助! 大家再看看怎么会有人出现这样的报错:Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\My Webs\php\sqlgunnews\common.inc.php on line 22
$_result=mysql_query("select * from system");
if(!!$_rows=mysql_fetch_array($_result)){ //这就是22行
$_system=array();
$_system['name']=$_rows['name'];
$_system['pagenums']=$_rows['pagenums'];
$_system['newsnums']=$_rows['newsnums'];
$_system['hotnums']=$_rows['hotnums'];
$_system['copy']=$_rows['copy'];
}else{
echoalert('系统配置错误!');
exit;
}
$_result=mysql_query("select * from system") or die(mysql_error());一切都大白于天下
echo "<script type='text/javascript'>alert('系统配置错误!');</script>\n";
我运行不报错,所以提示不出mysql_error()回复:T5500
echoalert('系统配置错误!');
这是一个自定义函数调用应该没有错
大家再看看怎么会有人出现这样的报错:Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\My Webs\php\sqlgunnews\common.inc.php on line 22
mysql_query('set names utf8');
数据库连接的时候也进行编码设置了我的mysql库也是utf8 这样还会有编码的问题?