If you're inserting an image into the database directly (not storing the image path, but the image itself), then you have to create an intermittent file which will display the image.
Display image from MS ODBC BLOB column, using ASP Pages
PHP Builder: How to Store Images Directly in the Sql Database
Those work. But basically all you do is send the Content-Type: header, and print the image information:
<?php
// Database connect & retrieve info
header("Content-type: image/jpg");
print($image_info_pulled_from_db);
?>
Then, to link to that db, you call the script from the <img> tag.
<img src="somescript.php?pid=XX">
Hope that helps.
~Brett