Jump to content

Archived

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

kikilahooch

displaying images from a database

Recommended Posts

I'm trying to display images on my page which are stored on my server. I have a field in my product table which stores the name of the image. I am then doing an sql query to call the products that are belonging to a specific department. What I want to do is display all the images in a table belonging to the specific dept along with their price and name. When I carry out the sql stmt though it only returns the 1st image and it also displays the address where it is stored which i dont want. Any tips on how i get around this??


[code]
$sql ="select image, prodName ,price  from product where dept = 'mens'";

$imageDir = "http://snet.wit.ie/clothes/";
$imagePath = "$imageDir$image"

.....
<img src="<?php echo("$imagePath"); ?>"></font>[/code]

Share this post


Link to post
Share on other sites
[!--quoteo(post=364340:date=Apr 13 2006, 11:23 AM:name=kikilahooch)--][div class=\'quotetop\']QUOTE(kikilahooch @ Apr 13 2006, 11:23 AM) [snapback]364340[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I'm trying to display images on my page which are stored on my server. I have a field in my product table which stores the name of the image. I am then doing an sql query to call the products that are belonging to a specific department. What I want to do is display all the images in a table belonging to the specific dept along with their price and name. When I carry out the sql stmt though it only returns the 1st image and it also displays the address where it is stored which i dont want. Any tips on how i get around this??
[code]
$sql ="select image, prodName ,price  from product where dept = 'mens'";

$imageDir = "http://snet.wit.ie/clothes/";
$imagePath = "$imageDir$image"

.....
<img src="<?php echo("$imagePath"); ?>"></font>[/code]
[/quote]


you have to concatenate the imagedir and $ image
like so
$imagePath = $imageDir."".$image;
and dont forget you semi colon like ya did above hope this helps

your image block should also be like this
<img src="<? echo $imagePath; ?>">

and that should do ya fine

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.