Boo, no html. This should be a little cleaner:
<?
mysql_pconnect("host","user","pw");
mysql_select_db("database");
$result = mysql_query("SELECT file from table where image_id='$id';");
$array = mysql_fetch_array($result);
header("Content-type: image/jpeg");
$fp = fopen("/your/file/directory/$array['file']", "r");
fpassthru($fp);
?>