slaterino Posted February 2, 2009 Share Posted February 2, 2009 Hi, I have a catalogue page which has a number of IF statements within it. One of these is if there is a value for the $ImageName field then script will be run that allows for this picture to be displayed. If there is no value for $ImageName then a default image will be displayed. For some reason I having massive problems doing this and can't work out why. I am using a while loop for this page as such: while($row = mysql_fetch_array($result, MYSQL_ASSOC)) I have checked that ImageName is being called from the database and it is. This is the code where I am having problems: if (!defined($row['ImageName'])) {echo '<img height="82" width="122" src="images/no_image-122x82.jpg" />'; } else {echo '<a class="thumbnail" href="#thumb"><img height="82" width="122" src="images/small/' . $row['ImageName'] . '" /><span><img src="images/big/' . $row['ImageName'] . '" /></span></a>'; } I have used a similar IF query like this before and never had any problems. I've tried using both $ImageName and $row['ImageName'] as the value above. I have also tried using is_null, $ImageName === NULL and isset but have had no luck whatsoever. Can anyone see what the problem might be? Thanks Russ Link to comment https://forums.phpfreaks.com/topic/143516-solved-trouble-creating-an-if-is_null-statement/ Share on other sites More sharing options...
trq Posted February 2, 2009 Share Posted February 2, 2009 if ($row['ImageName'] == '') Link to comment https://forums.phpfreaks.com/topic/143516-solved-trouble-creating-an-if-is_null-statement/#findComment-752862 Share on other sites More sharing options...
slaterino Posted February 2, 2009 Author Share Posted February 2, 2009 You're a genius, thank you very much!!! Link to comment https://forums.phpfreaks.com/topic/143516-solved-trouble-creating-an-if-is_null-statement/#findComment-752868 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.