当前位置:Gxlcms >
PHP教程 >
Warning:mysql_fetch_array()expectsparameter1toberesource解决思路
Warning:mysql_fetch_array()expectsparameter1toberesource解决思路
时间:2021-07-01 10:21:17
帮助过:33人阅读
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<=pagenum;$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;//输出多少条留言