Okay, i'm sorry for mistaking your code.
Hmm. have you tried executing this code in the MySQL processor? If you are on linux, have you gone into mysql (mysql -u user -p database) and tried out your query? perhaps the problem may lie there.
Also, are you sure that the proper image data is in the database? What is the datatype of the field? I usually use MEDIUMBLOB or LONGBLOB (any kind of blob should do)
Plus, I tried the code out. It works for me. Here is the output:
http://www.theslinky.com/phptests/image2.php
Also, here is the code:
<?php
mysql_connect("localhost", "xxxxxx", "xxxxxx");
$query = "SELECT * FROM banners WHERE bannerID = 1";
$res = mysql_db_query("phpads", $query);
$rows = mysql_num_rows($res);
if($rows < 1) {
print "No Image";
}
else {
$photo = mysql_fetch_object($res);
Header("Content-type: image/gif\n\n");
print $photo->banner;
}
?>
-sridhar