can anyone help me display my image coming from my database.. the datatype of the image being uploaded is "image".. I already tried some code base on my research but I only get a broken image or just the raw data coming from the database..

>Here is the code i used in displaying my image..

$sql = "SELECT StudentPicture from dbo.ES_Students where StudentNo = '2009100496'";
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false) {
die( print_r( sqlsrv_errors(), true) );
}

while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {
echo "<br/>";

$img = $row['StudentPicture'];
header('Content-Type: image/jpeg');
echo $img;


the output of that code is a broken image/invalid image icon..
thanks in advance for your reply