Display image from database

Ask about a PHP problem here.
Post Reply
Josh7Harington
Posts: 4
Joined: Mon Dec 05, 2011 1:26 pm

Display image from database

Post by Josh7Harington »

Hi there,

I need help with a gallery using the pagination tutorial on youtube.
Everything works great but instead of showing names like in the tutorial, i would like to show pictures from a database file (images.sql).

but my code for it keeps giving me broken errors from the <img src="" alt="" /> line.

if i want to show an image from the `image` column in the database `test`, what will the 'src="" ' or directory be ?

thanx,
Josh
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: Display image from database

Post by Temor »

are you inserting urls or full html code in the database?

easiest way would be to put the images on your server and insert the urls into your table and then retrieve them, put them in a variable and echo them out like this.

[syntax=php]
<img src="$img_url" />[/syntax]

also, show us what code you're having now and we might be able to help you fix it.
Post Reply