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

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

WBOY
Release: 2016-06-13 10:08:50
Original
1062 people have browsed it

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;//输出多少条留言
 

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template