<? 
include("database_conn.php");
$pid=$_GET['pid'];
$result = @mysql_query("SELECT * FROM products where PID='$pid'")or die("Cannot perform Query"); 
$row = @mysql_fetch_row($result); 
$image = $row[6];
header("Content-type: image/gif");
echo $image;
?> 