Hello all,

I have this strange problem.
1. I have one file in a sub directory which has code for displaying images - images are stored in main directory .
2. Now the reference to that image is retrieved from MySQL database table row[image].
here is the code i am using to display that image in outer directory:

echo " Image ".$row['image'];

This code is unable to display image which is located in the Main directory.
If it is notfrom database, i would have used a '/' before the url to get the image displayed.
What should i do here to display the image.Any help is appreciated.
Thank you.

What does $row print ? If you are in the subdirectory and if you want to print an image in the main directory, use .. .
ie., ../imagename.jpg

What does $row print ? If you are in the subdirectory and if you want to print an image in the main directory, use .. .
ie., ../imagename.jpg

well yeah it works when i have address of the url handy.

when i am retrieving the image url from database like row[1]
then how to code that?

where row[1] contains entire address like http://www.mysite.com/images/img1.jpg

I don't get it ! If you have the entire address in the table, why not simply use, echo "<img src='".$row['image']."'>"; ?

Comments
i appreciate ut time.

I don't get it ! If you have the entire address in the table, why not simply use, echo "<img src='".$row['image']."'>"; ?

sorry fr not being clear.

the row has this entire below mentioned as value:

<img src="upload/image1.jpg " width=70 >

i.e, it works fine when its in external directory but not if i use it in some sub directory as i have to modify the img src value.

This question has already been answered. Start a new discussion instead.