I have a basic display php table for images however some of the columns in the table are empty.
$result = mysql_query("SELECT * FROM table2
WHERE bid=$bid
AND fhid=$fhid
") or die(mysql_error());
echo "<table align='center'>";
while($row = mysql_fetch_array( $result )) {
echo "<tr><td>";
echo '<a href="'.$row['photo1'].'"target="_blank"><img src="'.$row['thumb1'].'" width="180" height="250" alt="'.$row['name'].' '.$row['alttext'].'"/></a>';
echo "</td><td>";
echo '<a href="'.$row['photo16'].'"target="_blank"><img src="'.$row['thumb16'].'"width="180" height="250"alt="'.$row['name'].' '.$row['alttext'].'"/></a>';
echo "</td><td>";
echo '<a href="'.$row['photo2'].'"target="_blank"><img src="'.$row['thumb2'].'" width="180" height="250"alt="'.$row['name'].' '.$row['alttext'].'"/></a>';
echo "</td></tr>";
}
echo "</table>";
If for example the row with photo16 was empty in the db table how can I change this script to skip the image without showing a missing image on the page and carry on to photo2.
I have checked all around and had no luck with NULL as it stops displaying the whole row. Thanks in advance.