realjumper Posted March 25, 2008 Share Posted March 25, 2008 Hi, How can I write my if statement to show the result if the varialble ( reading from the DB) is not empty or is not equal to NULL? I have been playing with the syntax but I can't get it right. Thanks for any help if ($row[sect1] != '' || $row[sect1] IS NOT 'NULL') { echo "Hello"; } Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted March 25, 2008 Share Posted March 25, 2008 Try this: if ($row['sect1'] != '' && !empty($row['sect1'])) Quote Link to comment Share on other sites More sharing options...
discomatt Posted March 25, 2008 Share Posted March 25, 2008 to check for null explicitly $var !== NULL Quote Link to comment Share on other sites More sharing options...
realjumper Posted March 25, 2008 Author Share Posted March 25, 2008 Okay, thanks very much.....I'll grab a coffee and try these methods. :-) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.