debcous Posted April 20, 2006 Share Posted April 20, 2006 I'm trying to display images in a table. The way that I have my images stored is that I have the name of the image stored in my database. I then have a variable ($imagepath) which stores the the directory of the image and the name of the image.[code]$imageDir = "http://snet.wit.ie/~debcous/clothes/";$imagePath = $imageDir."".$image;[/code]. I am displaying details in the table as follows:[code]<td align="center">'.$row['.$imagepath.'].'</td><td align="center">'.$row['prodName'].'</td><td align="center">'.$row['price'].'</td>[/code]But it is not displaying the image. Any clues??? Quote Link to comment Share on other sites More sharing options...
AndyB Posted April 20, 2006 Share Posted April 20, 2006 You need to code images similar to the below. Your code appears to only display a path...[code]<img src="imagename" ...> [/code] Quote Link to comment Share on other sites More sharing options...
debcous Posted April 20, 2006 Author Share Posted April 20, 2006 Thanks Andy. I am trying to display the images dynamically so I cannot hard code the full address. I have now changed it so that it is [code]<td align="center"><img src="http://snet.wit.ie/~debcous/clothes" ></td>[/code]how do I append the image field which stores the image name in my db to the end of it??? Quote Link to comment Share on other sites More sharing options...
Orio Posted April 20, 2006 Share Posted April 20, 2006 Just like this:[code]<td align="center"><img src="http://snet.wit.ie/~debcous/clothes/<?php echo $imagename; ?>" ></td>[/code]Orio. Quote Link to comment Share on other sites More sharing options...
debcous Posted April 20, 2006 Author Share Posted April 20, 2006 thanks orio, I dont know why but it still wont work! When i view the source code it shows:[code]<img src="http://snet.wit.ie/~debcous/clothes/<?php echo $image; ?>" ></td>[/code] Quote Link to comment Share on other sites More sharing options...
debcous Posted April 20, 2006 Author Share Posted April 20, 2006 Ì have actually gotten it to display out the image now by using[code]<img src="http://snet.wit.ie/~ciaracousins/clothes/'.$image.'[/code]but the problem is it is displaying out the very 1st image that I have stored in my db in every field. The prod name and price are different in every row but the image is staying the same? Any ideas why this is happening?? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.