Portal Home > Knowledgebase > Articles Database > Problem with PHP Script
Problem with PHP Script
Posted by cheyenne1212, 01-08-2008, 12:31 AM |
I found this script on a code site and borrowed it / modified it some.
This script is suppose to take the data from a table and let you download it as a excel / doc file, however I keep getting header errors.
This is the code :
The problem is this:
I get a bunch of errors
Warning: Cannot modify header information - headers already sent by (output started at /home/webmesto/public_html/test/excel2.php:1) in /home/webmesto/public_html/test/excel2.php on line 49
Warning: Cannot modify header information - headers already sent by (output started at /home/webmesto/public_html/test/excel2.php:1) in /home/webmesto/public_html/test/excel2.php on line 50
Warning: Cannot modify header information - headers already sent by (output started at /home/webmesto/public_html/test/excel2.php:1) in /home/webmesto/public_html/test/excel2.php on line 51
Warning: Cannot modify header information - headers already sent by (output started at /home/webmesto/public_html/test/excel2.php:1) in /home/webmesto/public_html/test/excel2.php on line 52
I'm pretty sure the error is where the headers are processed here:
But I'm not sure whats wrong.
Would this be an issue with a security feature on the server?
Anyone have any ideas??
Running PHP5 / Mysql 4.1
RHEL 5.
Thanks in advance!
|
Posted by boonchuan, 01-08-2008, 12:42 AM |
When I had some errors, what I normally did was go to php.ini, change the config to display errors only. After that the scripts worked and never seemed to have problems.
I may be missing out something but at least the script runs without errors (or rather there are invisible).
|
Posted by cheyenne1212, 01-08-2008, 12:55 AM |
changed php to show errors only, but same problem
I hate programming..don't even know why I'm doing this...lol
|
Posted by foobic, 01-08-2008, 01:20 AM |
Headers are the initial information sent to the browser - you can't change them after you've started to display the page. The errors are telling you that you started to display the page in this file at line 1 - probably a space before the |
Posted by cheyenne1212, 01-08-2008, 01:36 AM |
LOL....
There were some funky hidden characters as you said before my |
Posted by boonchuan, 01-08-2008, 01:40 AM |
Thanks something new I had learn today! Been wondering about that for a long time. At least now I know the reasons. Thanks once again. And goodness I never opt to be a programmer
|
Add to Favourites Print this Article
Also Read