something along these lines...you'll need to tweak it to fit your script, but you should get the idea...
//connect to mysql with your variables here...
//execute your sql query(s), store result in $result
//make a table to hold images and data
$output = "<table width=\"300\">";
//fetch each row of data
while($row = mysql_fetch_array($result))
//do something with each row of data
//refer to columns holding data as $row['columnName'];
//fill table with data...be sure to refer to the column/field names in your database table!
$output .= ("
<td><img src =\" ". $row['imageURL'] . "\"></td>
<td>". $row['imageTitle'] . "</td>
//close table tag
$output .= "</table>";
i usually just insert the path to the location of the image, so I'm not well versed in storing the actual image data in and retrieving it from the database...I stumbled across this tutorial on google, however, so maybe it will be of use to you...
Its not a good idea to store images in the database. As Ryan_vietnow has mentioned, it will add on to the server load, slows down the execution of the script and takes a lot of time to display it if you have more (say 100 images ) per page!