Home  >  Article  >  Backend Development  >  Warning: mysql_fetch_array() expects parameter 1 to be resource解决思路

Warning: mysql_fetch_array() expects parameter 1 to be resource解决思路

WBOY
WBOYOriginal
2016-06-13 10:08:501033browse

Warning: mysql_fetch_array() expects parameter 1 to be resource
$count_result = mysql_query("SELECT count(*) FROM bbs");
$count_array=mysql_fetch_array($count_result);
$pagenum=ceil($count_array['count(*)']/$pagesize);
echo '共',$count_array['count(*)'],' 条留言';
if($pagenum>1){
for($i=1;$i if($i==$p){
echo ' [',$i,']';
}
else {
echo ' ',$i,'';
}
}
}
无法显示共多少条留言。。。

------解决方案--------------------
用$count_result = mysql_query("SELECT * FROM bbs");
$count_array=mysql_num_rows($count_result);
echo $count_array;//输出多少条留言
 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn