All with empty fields in pic column should be ignored. (Even Name/Address shouldn’t be visible)
JavaScript
x
$sql = "SELECT pic, title, address FROM
WP_2344432";
$result = $conn->query($sql);
if ($result->num_rows > 0) { // output data of
each row
while($row = $result->fetch_assoc()) {
echo '<br> <img src="'.$row['pic'].'"><br>Name: '.
$row['title']. '<br>Coordinates: ' . $row['address'] .
'<br>';
}
} else {
echo "0 results";
}
Advertisement
Answer
If the pic
column contains null then add WHERE pic IS NULL
to your select. If it is simply empty then use WHERE pic = ''
.
JavaScript
$sql = "SELECT pic, title, address FROM WP_2344432 WHERE pic IS NOT NULL";
or
JavaScript
$sql = "SELECT pic, title, address FROM WP_2344432 WHERE pic != ''";