I am trying to display an image (later on it will be various file types) by pulling a BLOB string from a MySQL DB, yet I cannot get the image to display, even though my code looks like everyone else I see on the Internet.
<?
include "includes/config.php";
include "includes/opendb.php";
$id = $_GET['id'];
$sql = "SELECT * FROM video_index WHERE video_id = '$id'";
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_array($result);
$content = $row['video_content'];
header("Content-type: image/jpg");
echo $content;
?>
The config and opendb php files are to connect to the DB. If I try going to localhost/file.php?id=1, I get a missing image container that if I right click, does have the correct size, but obviously the image isn't showing. The record definitely exists, so I am totally stumped as to why this isnt working.
FYI, the image was uploaded to the LONGBLOB column in my DB using phpmyadmin.