When faced with a conditional fork, and things do not happen as you expect, you should var_dump the variable to see what VALUE it has and WHAT TYPE it is.
PHP Code:
var_dump($row['photo']);
eg if it is an empty string '' of 0 length, then that is what you should be checking for, get into the habid of using triple === to check for matches on type AND content.
PHP Code:
if( $row['photo'] === '') {
// then do something
}
Get used to thinking like this "When faced with a conditional fork, ...." whenever you are testing a variable otherwise you are destined to be posting such examples on forums like this for ever.
Take a look at this
PHP truth table, now do you see how many ways there are to interpret and empty string?
When you know this table by heart, then you can afford to relax and start using if($x) if(isset()) etc.
ps At some point another question you might want to investigate the answer to is, why have I got an empty string in my database at all, should it be a NULL?
Bookmarks