PHP replacing blank images with a default one
Having one of those brain fade moments this morning. I have the following
php:
$imgset = $result->fields[6];
if ($imgset = '')
{
$imgset = 'logo';
}
else
{
$imgset = $result->fields[6];
}
echo '<img id="imgdisp" src="/img/'.$imgset.'.jpg" />';
$imgset = '';
Where it looks to see if the result from the database is blank and if so,
should put in logo.jpg instead of whatever the result is. For some reason
though, it just does not want to work and I am probably being completely
blind, but cannot see why not. I still get blank images in the HTML and
filenames of "/img/.jpg" as though $imgset is still passing through a
blank. The values are not NULL in the SQL either, they are most definitely
blank entries inputted from an inputbox using a _POST in a form elsewhere.
Cheers for any help
Ben
No comments:
Post a Comment