query($querystatement); if($db->numRows($queryresult)){ $therecord = $db->fetchArray($queryresult); header('Content-type: '.$therecord["theMime"]); echo $therecord["theFile"]; }//end if ?>