# PHP - Warning: Cannot modify header information - headers already sent by

**URL:** <https://forum.kirupa.com/t/php-warning-cannot-modify-header-information-headers-already-sent-by/106077>\
**Category:** Uncategorized\
**Created:** [April 1, 2004, 5:24pm UTC](https://forum.kirupa.com/t/php-warning-cannot-modify-header-information-headers-already-sent-by/106077 "2004-04-01T17:24:50Z")\
**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 1, 2004, 5:24pm UTC](https://forum.kirupa.com/t/php-warning-cannot-modify-header-information-headers-already-sent-by/106077/1 "2004-04-01T17:24:50Z")

</div>

I’m doing this page so files can be downloaded. They will have different file types, that’s why I use the file type as a variable.

$dbQuery = "SELECT blobType, blobData ";  
$dbQuery .= "FROM myBlobs ";  
$dbQuery .= “WHERE blobId = $blobId”;  
$result = mysql\_query($dbQuery) or die(“Couldn’t get file list”);

if(mysql\_num\_rows($result) == 1)  
{  
$fileType = @mysql\_result($result, 0, “blobType”);  
$fileContent = @mysql\_result($result, 0, “blobData”);

header('Content-Type: ’ . $fileType); // HERE IS WHERE GIVES ME PROBLEMS

echo $fileContent;  
}

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

It gives me this error message = Warning: Cannot modify header information - headers already sent by (output started at C:\apache\Apache2\htdocs\JAVASCRIPT\downloadfile.php:4) in C:\apache\Apache2…

Line 4 is where PHP starts (\<?php). I already read from [php.net](http://php.net) and tried some suggestions, but it doesn’t seem to work.

Please help :hair:

Leo:)
