Good site: http://www.phpriot.com/articles/images-in-mysql/7
$itemId = (ISSET($_GET["iid"])) ? $_GET["iid"] : "-99";
// just so we know it is broken
error_reporting(E_ALL);
// some basic sanity checks
$querySelect = " SELECT image from products where id = '$itemId' ";
// the result of the query
$result = mysql_query("$querySelect") or die("Invalid query: " . mysql_error());
// set the header for the image
header("Content-type: image/jpeg");
echo mysql_result($result, 0);
?>
If you want image as part of another page, use blow line of code, which calls the above: