stublackett Posted July 17, 2008 Share Posted July 17, 2008 Hi, I have an Image1 and Image2 field in my Database it stores the URL String for the image in the Database i.e : directoryimages/cards.gif The user has the OPTION to upload up to 2 images, What I'd like to do is if the user hasnt uploaded say a second image. Instead of the browser displaying the nasty cross that says it cant find the image, To replace that with an image possibly saying "No Image Available" or something of that sort Is it possible to do that? Link to comment https://forums.phpfreaks.com/topic/115199-handling-images-pulled-from-a-database/ Share on other sites More sharing options...
unkwntech Posted July 17, 2008 Share Posted July 17, 2008 $sql = "SLECT image1, image2 FROM.........."; $result = mysql_query($sql); if(mysql_result($result, '0', 'image2') != '') { echo "<img src='" . mysql_result($result, '0', 'image2') . "'>"; } This is rough but it should work. Link to comment https://forums.phpfreaks.com/topic/115199-handling-images-pulled-from-a-database/#findComment-592332 Share on other sites More sharing options...
stublackett Posted July 17, 2008 Author Share Posted July 17, 2008 No joy with that Any further ideas? This can also to apply to image 1 aswell, If image1 or image2 is NULL then show a default image saying "NO IMAGE AVAILABLE" or something of that sort Link to comment https://forums.phpfreaks.com/topic/115199-handling-images-pulled-from-a-database/#findComment-592349 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.