An old chestnut I know but I am attempting to display images from a database blob field. The code works on Unix based hosting but does not on Win2K. I can confirm that the image is uploaded to the MySQL database since I have a commercial MySQL manager with a Blob viewer. This has an image option that displays the image as it should be. When attempting to view the image from the database with a php routine however, the dreaded X appears. Does anyone have any ideas. Viewing script is as follows.
<?php
// database connection
include "connect.php";
if (!$db)
{
echo 'Could not establish a database connection !!<br><br>';
exit;
};
mysql_select_db('db1');
$sql = "SELECT * FROM rbt100 WHERE image_id=".$_GET["iid"];
$result = mysql_query ($sql);
if (mysql_num_rows ($result)>0) {
$row = @mysql_fetch_array ($result);
$image_type = $row["image_type"];
$image = $row["image"];
Header ("Content-type: $image_type");
print $image;
}
?>