Jump to content

Archived

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

debcous

displaying images in a table

Recommended Posts

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

Share this post


Link to post
Share on other sites
You need to code images similar to the below. Your code appears to only display a path...
[code]<img src="imagename" ...> [/code]

Share this post


Link to post
Share on other sites
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???

Share this post


Link to post
Share on other sites
Just like this:
[code]<td align="center"><img src="http://snet.wit.ie/~debcous/clothes/<?php echo $imagename; ?>" ></td>[/code]

Orio.

Share this post


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

Share this post


Link to post
Share on other sites
Ì 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??

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.