Jump to content

how can i display images from my database with php


perfo4911

Recommended Posts

post your code

Link to comment
Share on other sites

Just store the link/path to the image you want in the database.Example: (Items in parenthesis are what you will put into the fields. Just examples though) tableField 1: id (1)Field 2: name (banner)Field 3: image (images/banner.png) Then all the php would look something like is.

<?php$query = "SELECT * FROM table WHERE name = 'banner' LIMIT 1";$set = mysql_query($query, $connection);$result = mysql_fetch_array($set);echo "<img src=\"{$result['img']}\" alt=\"{$result['name']}\";?>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...