php如何判断SQL语句的查询结果是否为空?
代码如下:
<br />$sql =mysql_query( "select * from tv_video where title like '%$keyword%' limit $offset,$PageSize");<br />$result=mysql_fetch_array($sql);<br />if(!empty($result)){<br />while($result=mysql_fetch_array($sql)){echo "hello word!"}<br />if(!empty($result)){<br />echo "记录为空";<br />}<br />
$result =mysql_query( "select * from tv_video where title like '%$keyword%' limit $offset,$PageSize");<br />if (mysql_num_rows($result) < 1) echo '记录集为空';
$result =mysql_query( "select * from tv_video where title like '%$keyword%' limit $offset,$PageSize");<br />if(count($result)<0)<br />{<br />echo "查询无数据!";<br />}