# PHP header already changed but i get garbage as jpg

**URL:** <https://forum.kirupa.com/t/php-header-already-changed-but-i-get-garbage-as-jpg/47355>\
**Category:** programming\
**Created:** [April 2, 2004, 10:25pm UTC](https://forum.kirupa.com/t/php-header-already-changed-but-i-get-garbage-as-jpg/47355 "2004-04-02T22:25:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![imagined](https://avatars.discourse-cdn.com/v4/letter/i/a87d85/32.png) [@imagined](https://forum.kirupa.com/u/imagined)\
**Post date:** [April 2, 2004, 10:25pm UTC](https://forum.kirupa.com/t/php-header-already-changed-but-i-get-garbage-as-jpg/47355/1 "2004-04-02T22:25:36Z")

</div>

I have 2 files:

include\_display.php \<\< contains the connection to the database, get the blobData and the blobType. Uses variable blobType to change the header.

$dbQuery = "SELECT blobType, blobData ";  
$dbQuery .= "FROM testBlobs ";  
$dbQuery .= “WHERE blobId = $blobId”;

$result = mysql\_query($dbQuery) or die(“Couldn’t get file list”);

$data = @mysql\_fetch\_array($result);  
if(!empty($data[“blobData”]))  
{

// Output the MIME header  
header(“Content-Type: $blobType”);  
}

else  
{  
echo “Record doesn’t exist.”;  
}

and then I have display.php \<\< its supposed to display the image  
but instead of the image, i get bunches of letters, numbers, and symbols. of course, this means the header hasnt been changed.

echo $data[“blobData”];

what am i doing wrong?
