kikilahooch Posted April 13, 2006 Share Posted April 13, 2006 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 https://forums.phpfreaks.com/topic/7293-displaying-images-from-a-database/ Share on other sites More sharing options...
predator12341 Posted April 13, 2006 Share Posted April 13, 2006 [!--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 $ imagelike so$imagePath = $imageDir."".$image;and dont forget you semi colon like ya did above hope this helpsyour image block should also be like this<img src="<? echo $imagePath; ?>">and that should do ya fine Link to comment https://forums.phpfreaks.com/topic/7293-displaying-images-from-a-database/#findComment-26551 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.