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?
 
webwyzsystemsConnect With a Mentor Commented:
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
 
movieprodwAuthor Commented:
Thanks
0
All Courses

From novice to tech pro — start learning today.