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"; } Link to comment https://forums.phpfreaks.com/topic/97853-not-null-question/ 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'])) Link to comment https://forums.phpfreaks.com/topic/97853-not-null-question/#findComment-500680 Share on other sites More sharing options...
discomatt Posted March 25, 2008 Share Posted March 25, 2008 to check for null explicitly $var !== NULL Link to comment https://forums.phpfreaks.com/topic/97853-not-null-question/#findComment-500687 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. :-) Link to comment https://forums.phpfreaks.com/topic/97853-not-null-question/#findComment-500697 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.