ltoto Posted November 7, 2006 Share Posted November 7, 2006 right i simply want to put an if state around this to do the following: if there is no picture, show nothing:around this[code]<li><a href="/pages/showimage0.php?hotelId=<?php echo $row_rsAccom['hotelId'];?>" target="_blank"><img src="../thumb/phpThumb.php?src=../images/hotel_<?php echo $row_rsAccom['hotelImage1']; ?>&w=50&h=50&zc=1&err=../images/noimage1.jpg" border="0"Latest Deals></a></li>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/26447-if-statement-help/ Share on other sites More sharing options...
banachec_00 Posted November 7, 2006 Share Posted November 7, 2006 You could try checking if the image is null. For example,if ($row_rsAccom['hotelImage1'] != "") { // Show Picture }else { // show no image }Hope this helps Quote Link to comment https://forums.phpfreaks.com/topic/26447-if-statement-help/#findComment-120945 Share on other sites More sharing options...
xtentic Posted November 7, 2006 Share Posted November 7, 2006 Well i see that you havent read the PHP guide about IF statements.. to badbut i'll help you abit..[code]<?php?><li><a href="/pages/showimage0.php?hotelId=<?php echo $row_rsAccom['hotelId'];?>" target="_blank"><?phpif (file_exists('../images/hotel_' . $row_rsAccom['hotelImage1'])){ echo '<img src="../thumb/phpThumb.php?src=../images/hotel_<?php echo $row_rsAccom['hotelImage1'] . '">';}else{ echo '<img src="../images/noimage1.jpg" border="0">';}echo 'Latest Deals></a></li>';?>[/code]something like this.. (out of my head... so not tested in anyway!) Quote Link to comment https://forums.phpfreaks.com/topic/26447-if-statement-help/#findComment-120948 Share on other sites More sharing options...
kenrbnsn Posted November 7, 2006 Share Posted November 7, 2006 The syntax of the given solution is incorrect, try:[code]<?phpif (file_exists('../images/hotel_' . $row_rsAccom['hotelImage1'])) echo '<img src="../thumb/phpThumb.php?src=../images/hotel_' . $row_rsAccom['hotelImage1'] . '">';else echo '<img src="../images/noimage1.jpg" border="0">';echo 'Latest Deals></a></li>';?>[/code]Ken Quote Link to comment https://forums.phpfreaks.com/topic/26447-if-statement-help/#findComment-120951 Share on other sites More sharing options...
ltoto Posted November 7, 2006 Author Share Posted November 7, 2006 i appologise, i dont want it to show noimage.jpg, i just dont want anything to show up Quote Link to comment https://forums.phpfreaks.com/topic/26447-if-statement-help/#findComment-120956 Share on other sites More sharing options...
roopurt18 Posted November 7, 2006 Share Posted November 7, 2006 Then leave off the else part as it's optional. I would suggest going to google and searching for: php ifand following the first link that points to the PHP manual. Quote Link to comment https://forums.phpfreaks.com/topic/26447-if-statement-help/#findComment-121004 Share on other sites More sharing options...
ralph4100 Posted November 7, 2006 Share Posted November 7, 2006 whew that was a tough problem Quote Link to comment https://forums.phpfreaks.com/topic/26447-if-statement-help/#findComment-121010 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.