0

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.

1
Contributor
1
Reply
3
Views
6 Years
Discussion Span
Last Post by ptara1
0

solved the problem. Had to change img tag to:

<?
$ID=$_GET['ID'];
echo "<img src='picscript.php?ID=".$ID."'>";
?>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.