Make an include file that gets the binary data from the table and puts it into a variable. Something like this.
<?
// connect to DB code
$sql = "SELECT * FROM table WHERE id = '" . $_GET['id'] . "'";
$result = mysql_query($sql);
if ($row = mysql_fetch_array($result)) {
header("Content-type: image/pjpeg");
echo $row['binary_data'];
}
?>
Pass a variable to it in an IMG SRC tag like this...
<A HREF='imagescript.php?id=10'>
Make sure there is no HTML output before the header line. Probably don't need to use mysql_fetch_array if you only need the binary data. Just get it however you need.