Jump to content

[SOLVED] Trouble creating an IF is_null statement


slaterino

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.