w00kie Posted April 24, 2006 Share Posted April 24, 2006 I have a database with 10 thumbnail pictures, image1, image2, image3 and so fourthwhen i add a picture, i add the - 'event_images/image1.jpg' for instance which is fine. But, what i need help with is, if the cell for image1, is empty, it doesnt contain a path then to dispaly a Blank image. Such as 'event_images/spacer.jpg'thanks for your help in advanced.[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]if ($image_1 == "") {echo "<a href=event_images/blank.jpg><img name=eventimage src=event_images/blank.jpg width=40 height=40 border=2></a> ";} else {echo "<a href=event_images/$image_1><img name=eventimage src=event_images/$image_1 width=40 height=40 border=2></a> ";}[/quote]Thats what i was thinkinjg, would there be an easier way? Quote Link to comment Share on other sites More sharing options...
wisewood Posted April 24, 2006 Share Posted April 24, 2006 does it just not display the image, or does it display the X image not exist icon?ie, is it that your if/else doesnt work, or that there is an error in your code within the if/else Quote Link to comment Share on other sites More sharing options...
freakus_maximus Posted April 24, 2006 Share Posted April 24, 2006 If this what you are adding to the db:[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]when i add a picture, i add the - 'event_images/image1.jpg' for instance which is fine. [/quote]And this is what you are using to retrieve:[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]src=event_images/$image_1 [/quote]Then your src path is actually "event_images/event_images/image1.jpg". Which, unless you have your folders structred that way, would not be correct.Also, I think this:[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]echo "echo "<a href=event_images/$image_1><img name=eventimage src=event_images/$image_1 width=40 height=40 border=2></a> ";[/quote]Should be:[code]echo ('<a href=event_images/$image_1><img name=eventimage src=event_images/'.$image_1.' width=40 height=40 border=2></a>');[/code]If that doesnt help let us know... Quote Link to comment 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.