Hi there
This problem is doing my head in!!
I've tried numerous tutorials on how to display images from a mysql database using php.
The code below displays the binary information for the image rather than the image itself.
Does anyone have any idea what I'm doing wrong?
Any help greatly appreciated.
Wendy
<?
<?php
// again we check the $_GET variable
$sql = "SELECT type, size, name, content FROM images WHERE imageid=1";
$link = mysql_connect(" ....... ") or die("Could not connect: " . mysql_error());
// select our database
mysql_select_db("scsh") or die(mysql_error());
$result = mysql_query($sql) or die("Invalid query: " . mysql_error());
while($row=mysql_fetch_array($result)) {
echo 'This is '.$row['name'].' from the database<br />';
echo '<img '.$row['content'].' src="imagedownload.php?imageid=1">';
}
?>