Jump to content

displaying images from a database


kikilahooch

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.