displaying image using a name stored in mysql database.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
roondog
Forum Newbie
Posts: 18
Joined: Sun Jul 22, 2007 11:56 am

displaying image using a name stored in mysql database.

Post by roondog »

I am trying to make a news page with a picture for each news item. I have uploaded the picture and inputed the news story to the database. I'm having trouble displaying the image. I'm using this at the moment:

echo "<img src=".$row['imgname'];" />";

but i need to add ./images/ to it. I've tried

echo "<img src=""./images/".$row['imgname'];" />"; but to no avail.

the top code displays a box where an image should be.

any ideas?
ianhull
Forum Contributor
Posts: 310
Joined: Tue Jun 14, 2005 10:04 am
Location: Hull England UK

Post by ianhull »

try ../images
roondog
Forum Newbie
Posts: 18
Joined: Sun Jul 22, 2007 11:56 am

Post by roondog »

I've managed to get the imgname to be in the database as ./images/**.jpeg so when i call the image
i use echo "<img src=".$row['imgname']." />"; which seems to be working. Thanks for the help though.
Post Reply