I'm trying to display a picture stored in a msyql database. I have the following script, picscript.php, to call the picture from the database:


$username = '';
$password = '';
$host = '';
$database = '';

mysql_connect($host, $username, $password) or die("Can not connect to database: ".mysql_error());

mysql_select_db($database) or die("Can not select the database: ".mysql_error());

$query = mysql_query("SELECT * FROM norestaurants WHERE ID='".$ID."'");
$row = mysql_fetch_array($query);
$content = $row['pic1'];

header('Content-type: image/jpg');
     echo $content;

I currently have this tag to display it on another page.

<img src="picscript.php?ID='".$ID."'">

All I get is a little picture icon. Any help would be appreciated.

solved the problem. Had to change img tag to:

echo "<img src='picscript.php?ID=".$ID."'>";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.