I've got a small bit of code here that never checks for an empty value (in other words, it always finds something in there, even if it's completely empty in the database). Can anyone else see my problem?
If there is an entry in the DB named default.gif or some other image, and they've chosen to upload nothing, keep the image as is. But if it's empty in the database (and they've still chosen to not upload an image), we need to put in default.gif.
$sql_image = "SELECT picture, product_id
FROM products
WHERE product_id='$pid'";
$query_image = mysql_query ($sql_image, $db_connection) or die (mysql_error());
$query_row = mysql_fetch_array ($query_image);
if (($query_row[picture] != 'none') || ($query_row[picture] != 'default.gif')) {
echo "Image already exists. Keeping current image.<br>";
$userfile_name = $query_row[PIC];
} elseif ($query_row[picture] == 'none' || '' || 'empty' || 'NULL') {
echo "No image exists. Reverting to default image.<br>";
$userfile_name = "default.gif";
}