(转)php连接mysql如何判断数据为空?

<?php
$result_a=mysql_query("select * from product_tag where product_id=$row[id]");
$num = 0;
$num = mysql_num_rows($result_a);

if(!$num == 0){
?>
<td><div style="padding-left:40px;">Sport:</div></td><td>
<?php
while($row_a=mysql_fetch_array($result_a))
{
$row_b=mysql_fetch_array(mysql_query("SELECT * FROM `tag_tag` WHERE id=$row_a[tag_id]"));
if($row_b[classid]==5)
{
echo $row_b[tag_name];
}
}
?>
</td>

<?php
}
?>
posted @ 2016-01-27 10:13  wanshutao  阅读(519)  评论(0编辑  收藏  举报