<?php

if($id) {

$db = @mysql_connect("www.rationalmind.net", "capworld", "capworld");
mysql_select_db("capworld",$db);

$sql = "select Image, imgtype from articles where id=$id";

$result = mysql_query($sql,$db);
if ($myrow = mysql_fetch_array($result)) {

$type = $myrow["imgtype"];
$data= $myrow["Image"];

    Header( "Content-type: $type");
    echo $data;

}else { 

echo "error getting image!"; }
};
?>