# 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/106171>\
**Category:** Uncategorized\
**Created:** [April 2, 2004, 10:25pm UTC](https://forum.kirupa.com/t/php-header-already-changed-but-i-get-garbage-as-jpg/106171 "2004-04-02T22:25:36Z")\
**Posts on this page:** 2\
**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/106171/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?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 6, 2004, 1:19pm UTC](https://forum.kirupa.com/t/php-header-already-changed-but-i-get-garbage-as-jpg/106171/2 "2004-04-06T13:19:02Z")

</div>

Sooo, then a database would not be useful in this case, right?
