PHP, Java if photo does not load do not show result

Hello,

I have the below code and I know that I can use:
onerror=\"this.style.display='none'\"

to make the image not show but how do I make the entire listing not show?

Any help would be great.

Matt
?>
		
		<div class="result">

			<div class="image"><a href="#"><img src="<?php echo $aProperty[$j]["sImg"]; ?>" alt="" width="190" height="120" border="0" /></a></div>
			<div class="desccol">
			<div class="title"><?php echo $aProperty[$j]["sTitle"]; ?></div>
			<div class="desc"><?php //echo $aProperty[$j]["sLocation"]; ?>
			
			<?php echo $aProperty[$j]["sDescription"];?><br/>
			<span class="details">$<?php echo $aProperty[$j]["sPrice"]; ?> | Updated <?php echo $aProperty[$j]["dUpdated"];?></span></div>
	
			</div>
		</div>
		<div style="clear:both;"></div>
		
		<?php
		
		$j++;
	}
		}
?>

Open in new window

LVL 1
movieprodwAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

webwyzsystemsCommented:
What you need to do is to check whether there is an image or not, then only proceed with the code if the image exists. I added a statement on top and bottom. Hopefully this gives you what you want.

<?php if ($aProperty[$j]["sImg"]): ?>
<div class="result">
<div class="image"><a href="#"><img src="<?php echo $aProperty[$j]["sImg"]; ?>" alt="" width="190" height="120" border="0" /></a></div>
<div class="desccol">
<div class="title"><?php echo $aProperty[$j]["sTitle"]; ?></div>
<div class="desc"><?php //echo $aProperty[$j]["sLocation"]; ?>
<?php echo $aProperty[$j]["sDescription"];?><br/>
<span class="details">$<?php echo $aProperty[$j]["sPrice"]; ?> | Updated <?php echo $aProperty[$j]["dUpdated"];?></span></div>
</div>
</div>
<div style="clear:both;"></div>
<?php endif; ?>

....rest of your code here
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
movieprodwAuthor Commented:
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.