Jump to content


Photo

displaying images in a table


  • Please log in to reply
5 replies to this topic

#1 debcous

debcous
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 20 April 2006 - 12:10 PM

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.

$imageDir = "http://snet.wit.ie/~debcous/clothes/";
$imagePath = $imageDir."".$image;

. I am displaying details in the table as follows:

<td align="center">'.$row['.$imagepath.'].'</td>
<td align="center">'.$row['prodName'].'</td>
<td align="center">'.$row['price'].'</td>

But it is not displaying the image. Any clues???

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 20 April 2006 - 12:32 PM

You need to code images similar to the below. Your code appears to only display a path...
<img src="imagename" ...>

Legend has it that reading the manual never killed anyone.
My site

#3 debcous

debcous
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 20 April 2006 - 12:44 PM

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

<td align="center"><img src="http://snet.wit.ie/~debcous/clothes" ></td>

how do I append the image field which stores the image name in my db to the end of it???

#4 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 20 April 2006 - 01:58 PM

Just like this:
<td align="center"><img src="http://snet.wit.ie/~debcous/clothes/<?php echo $imagename; ?>" ></td>

Orio.
Think you're smarty?

(Gone until 20 to November)

#5 debcous

debcous
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 20 April 2006 - 02:18 PM

thanks orio, I dont know why but it still wont work! When i view the source code it shows:

<img src="http://snet.wit.ie/~debcous/clothes/<?php echo $image; ?>" ></td>


#6 debcous

debcous
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 20 April 2006 - 02:30 PM

Ì have actually gotten it to display out the image now by using

<img src="http://snet.wit.ie/~ciaracousins/clothes/'.$image.'

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users