Jump to content


Photo

displaying images from a database


  • Please log in to reply
1 reply to this topic

#1 kikilahooch

kikilahooch
  • Members
  • PipPipPip
  • Advanced Member
  • 72 posts

Posted 13 April 2006 - 10:23 AM

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


$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>


#2 predator12341

predator12341
  • Members
  • PipPipPip
  • Advanced Member
  • 87 posts
  • LocationCheshunt, Hertfordshire, England

Posted 13 April 2006 - 12:31 PM

[!--quoteo(post=364340:date=Apr 13 2006, 11:23 AM:name=kikilahooch)--][div class=\'quotetop\']QUOTE(kikilahooch @ Apr 13 2006, 11:23 AM) View Post[/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??
$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>
[/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
[a href="http://www.sloganizer.net/en/" target="_blank"][/a]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users