Jump to content

Archived

This topic is now archived and is closed to further replies.

w00kie

Pulling images from DB

Recommended Posts

I have a database with 10 thumbnail pictures, image1, image2, image3 and so fourth

when 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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.