jpetsel Posted February 1, 2007 Share Posted February 1, 2007 This will be obvious as I talk here, but I am a newb in PHP/MySQL. So sorry ahead of time. I have built a script that takes items from a form. Among the items collected are 5 images spots that give the client the ability to add images to his website (realestate). My problem comes when he does not add 5 images. Let say he only uploads 3. Due to the the fact there is no image it shows up as a blank space. What I want is a way to say go, hey no image place stock "No image avaliable" image. Please point me in the right direction. I have post a link to an example of how it looks right now. http://www.bishopfarmsalesandfinancing.com/viewdetails.php?id=40 Link to comment https://forums.phpfreaks.com/topic/36660-image-replacement/ Share on other sites More sharing options...
Balmung-San Posted February 1, 2007 Share Posted February 1, 2007 If I read this post right, all you'd need to do would be to set a default value for the field which holds the image in your MySQL database. That is assuming you're storing the URL of the image, as opposed to the image itself, in your database. Link to comment https://forums.phpfreaks.com/topic/36660-image-replacement/#findComment-174763 Share on other sites More sharing options...
jpetsel Posted February 1, 2007 Author Share Posted February 1, 2007 You pretty much hit it on the head, my problem comes on the how to implement it and let it know when there isn't an image. Link to comment https://forums.phpfreaks.com/topic/36660-image-replacement/#findComment-174839 Share on other sites More sharing options...
Balmung-San Posted February 1, 2007 Share Posted February 1, 2007 Easy enough, just specify a default value in your database. i.e. field_name varchar(255) NOT NULL DEFAULT 'image/image.jpg' Then just don't insert anything to that field. Is that what you're looking for? Link to comment https://forums.phpfreaks.com/topic/36660-image-replacement/#findComment-174851 Share on other sites More sharing options...
smc Posted February 1, 2007 Share Posted February 1, 2007 Or you can do this $imageupload3 = $_POST["Upload3"]; if ( $imageupload3 = "" ) { $imageupload3 = "http://yoursite/images/image.jpg"; } Where Upload3 is the name of your 3rd Upload field, follow that example of the others. Hope this helps Link to comment https://forums.phpfreaks.com/topic/36660-image-replacement/#findComment-174920 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.