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

<?
	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" />

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

many thanks again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.