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
https://forums.phpfreaks.com/topic/245353-using-select-from-on-blob-files/
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.