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] 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 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!) 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 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 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. 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 Link to comment https://forums.phpfreaks.com/topic/26447-if-statement-help/#findComment-121010 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.