0

Hi

I have 3 image placeholders taken from a recordset.

If the image URL is in the database table column then the image shows as you would expect.

However if no image exists I want to force the code to pick up a blank image from location:

propertyimages/dot.gif

Current code just taking image from the recordset:

<a class="thumbnail" href="#thumb"><img src="<?php echo $row_rs_details['image_main']; ?>" width="240" height="160" border="0" /><span><img src="<?php echo $row_rs_details['image_main']; ?>" /><br />
</span></a>

If anyone knows how to add some code which basically says if no image exists goto /propertyimages/dot.gif as the image source - then I would be very appreciative.

Many thanks for the help

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by ebanbury
0
<?
	if($row_rs_details['image_main'] == "")
		$src = 'propertyimages/dot.gif';
	else
		$src = $row_rs_details['image_main'];
?>
<img src="<?php echo $src ?>" width="240" height="160" border="0" />

Edited by vibhaJ: n/a

0

Excellent...thank you! So easy when you see it :-)
I think my brain has just become silted :-(

many thanks again.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.