php查询数据库结果是否为空的判断

WBOY
Release: 2016-06-23 14:09:42
Original
2001 people have browsed it

if (empty($result)) {echo "

没有查到哦

";}
else {
$numRows = mssql_num_rows($result); 
echo "




";
while($row=mssql_fetch_array($result))
{
echo"";
echo"";
echo"";
echo"";
}
mssql_close($dbhandle);
}

没有效果,还是去查询,输出空的表格表头。


回复讨论(解决方案)

把empty($result)换成$result = "" 试试,之前好像碰到过这个问题

我已经知道了。谢谢。

月份 抄表数
";
echo $row[1];
echo"
$row[4]
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!