Prima cosa utilizza un campo di tipo blob per contenere le immagini poi eccoti un esempio:
<?php
$link = mysql_connect('localhost', 'root', '');
if (!$link) {
die('Not connected : ' . mysql_error());
}
// make foo the current db
$db_selected = mysql_select_db('test', $link);
if (!$db_selected) {
die ('Can\'t use foo : ' . mysql_error());
}
$sql = "SELECT image FROM table";
$query = mysql_query($sql);
$r = mysql_fetch_array($query);
Header("Content-type: image/gif");
echo $r['image'];
?>