Kai74 Posted May 7, 2004 Share Posted May 7, 2004 I’m making a page for a friend. He will add some text an upload some pictures to the page. All this is saved in MySql. He have the possibility to upload 5 pictures to each text. If he the only upload 2 pictures we will have some boxes with a red x. Then I made this. and I believe I have forgotten something. <?php if($row_Bilder['bilde1'] != "") { ?> <div align="center"><a href="<?php echo $row_Bilder['bilde1']; ?>"><img src="<?php echo $row_Bilder['bilde1']; ?>" width="80" height="80" border="0"></a></div> <?php } ?></td><td width="103"> <?php if($row_Bilder['bilde2'] != "") { ?> <div align="center"><a href="<?php echo $row_Bilder['bilde2']; ?>"><img src="<?php echo $row_Bilder['bilde2']; ?>" width="80" height="80" border="0"></a></div> <?php } ?> </tr> . This is almost working. the only thing is that picture nr 1 ($row_Bilder['bilde1') will not show on the page. But picture 2 is working. STRANGE This has been killing me. I need really some help. Take a look. vanvara.net Quote Link to comment https://forums.phpfreaks.com/topic/1836-images-with-null-value-in-mysql/ Share on other sites More sharing options...
Milshak Posted May 20, 2004 Share Posted May 20, 2004 if there is a null in the image varialbe it will not display the image but the HTML is still there so you get a image missing x on the browser. Try a n if statement to check that the image exits first if so display it other wise display a default image or don't sent any html. if(row_Bilder[1}( img src=<?php echo $row_Bilder['bilde1]; } else{ display either a default image or no image. Quote Link to comment https://forums.phpfreaks.com/topic/1836-images-with-null-value-in-mysql/#findComment-6039 Share on other sites More sharing options...
Milshak Posted May 20, 2004 Share Posted May 20, 2004 on one of my sites I use this; if($row[4]==""){ echo"<td class=\"producttext\"><a href=\"details.php?id=$row[0]&storeID=$storeID¤cy=$currency\"><img src=\"../images/savers/image_not_available.jpg\"></a></td>"; }else{ echo "<TD valign=\"top\" class=\"producttext\"><a href=\"details.php?id=$row[0]&storeID=$storeID¤cy=$currency\"> <img src=\"../images/savers/$row[4]\"></a> </TD>"; } where row[4] would be my image variable Quote Link to comment https://forums.phpfreaks.com/topic/1836-images-with-null-value-in-mysql/#findComment-6040 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.