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:

<?php

$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());

$ID=$_GET['ID'];
$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:

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

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