<?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
}
?>