Prevent showing table array if database table is empty?
How do I add an if statement to not display this table if the database
table filmInfo is empty?
$quary="SELECT filmTitle, filmRole, filmDirector, idfilm FROM filmInfo,
actorsInfo
WHERE (actorsInfo.id = filmInfo.id_actor) AND email = '$_SESSION[email]'";
$result = mysql_query($quary);
$count=mysql_numrows($result);
echo "<table>";
echo "<table border='1' style='border-collapse: collapse;border-color:
silver;'>";
echo "<tr style='font-weight: bold;'>";
echo "
<td width='20' align='center'>#</td>
<td width='200' align='center'>TITLE</td>
<td width='200' align='center'>ROLE</td>
<td width='200' align='center'>DIRECTOR</td>";
echo "</tr>";
$row_number = 1;
while ($row = mysql_fetch_array($result)) {
$id_actor= $row["id_actor"];
$idfilm= $row["idfilm"];
$filmTitle= $row["filmTitle"];
$filmRole= $row["filmRole"];
$filmDirector= $row["filmDirector"];
echo"<tr>";
echo '<td><input name="checkbox[]" value="'.$idfilm.'" type="checkbox"
id="checkbox'.$row_number.'" /></td>';
for ($i=0; $i<3; $i++) {
echo"<td> $row[$i]</td>";
}
echo"</tr>";
$row_number++;
}
echo"</table>";
No comments:
Post a Comment