Jump to content

Using SELECT * FROM on blob files


TomFromKWD

Recommended Posts

Hi guys,

 

I have a feeling the answer to this will be something incredibly simple I will be amazed I have failed to overlook but lets see.

 

I have a database currently storing images as BLOB, it appears to be holding them fine, my upload page works fine to put images there etc

The issue is coming when trying to display the images on an alternate page.

 

I am using the code below, and it seems to recognize the field, however it is not displaying an image, it is displaying code.

I have a feeling I need to add something to my headers to allow the page to show the images, but am not 100% sure.

If someone could let me know what I am missing it would be great.

Thanks in advance.

 

<?
include "config.php";
$query = mysql_query("Select * FROM app_images WHERE image_month='test' ") or die(mysql_error());
while ($row = mysql_fetch_array($query)) {
echo " " .$row['image']. " <br /><br />";}
?>

Link to comment
Share on other sites

What you want to do is create another file that will serve the images. That file will fetch the image from the database, and output the data along with the appropriate header. Then you can use it like:

 

<img src="image.php?id=5" alt="" />

 

For example, where image.php is the file that serves the image from the database.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.