Using GET and a simple SELECT query, I am selecting the url to a pic from the database. If no url is present in the db (ie no pictures have been uploaded) then the script should echo 'Photo not on file'. Seems that regardless of how I validate and echo the results, the script will echo the first condition of the if / else statement. When there is no pic url in the db instead of echoing 'Photo not on file' it echoes a blank image.
<?php
$obit_id=$_GET['obit_id'];
require_once('./mysql_connect.php');
$query = "SELECT picture FROM obituary WHERE obit_id = '$obit_id'";
$result = @($query);
if ($result) {
$row = @mysql_fetch_array($result, MYSQL_NUM);
$pic = $row[0];
echo "<img src=$pic>";
} else {
echo "No Photo on File";
}
?>
Have tried validating with (mysql_num_rows) and other methods same results.
Have tried putting a default value (X) in the db for all NULL entries and checking for that to set the conditions for if / else same results.
Very simple code but can't see my mistake. Any Help?