Maison >développement back-end >tutoriel php > Warning: mysql_fetch_array() expects parameter 1 to be resource解决思路
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;//输出多少条留言