HowdeeDoodee Posted June 25, 2007 Share Posted June 25, 2007 I am getting this error message in one file but not another. How can I trace down the cause of this error message? No blank lines exist in this file outside of the php tags. Thank you in advance for your replies. Quote Link to comment https://forums.phpfreaks.com/topic/57159-solved-cannot-modify-header-information-headers-already-sent-by/ Share on other sites More sharing options...
pocobueno1388 Posted June 25, 2007 Share Posted June 25, 2007 Post your code...there is also a bold sticky about this that you should read first. http://www.phpfreaks.com/forums/index.php/topic,37442.0.html Quote Link to comment https://forums.phpfreaks.com/topic/57159-solved-cannot-modify-header-information-headers-already-sent-by/#findComment-282431 Share on other sites More sharing options...
trq Posted June 25, 2007 Share Posted June 25, 2007 Did you read the sticky at the top of this forum? Quote Link to comment https://forums.phpfreaks.com/topic/57159-solved-cannot-modify-header-information-headers-already-sent-by/#findComment-282432 Share on other sites More sharing options...
sKunKbad Posted June 25, 2007 Share Posted June 25, 2007 post your error line # too Quote Link to comment https://forums.phpfreaks.com/topic/57159-solved-cannot-modify-header-information-headers-already-sent-by/#findComment-282433 Share on other sites More sharing options...
HowdeeDoodee Posted June 26, 2007 Author Share Posted June 26, 2007 Color my face red, no I did not read the sticky. Shame on me. Here is the full error message. Warning: Cannot modify header information - headers already sent by (output started at /home/findt/public_html/CP/searchtest.php:65) in /home/findt/public_html/CP/searchtest.php on line 827 $result = mysql_query($query) or die(mysql_error()); $num_record = mysql_num_rows($result); $sql_num_rows = mysql_num_rows($result); //echo "Number of effected rows: $sql_num_rows"; if($sql_num_rows < (1)) { echo " No records were found. "; header("location: /CP/errorpage_norecords.htm"); exit; } Line 827 is the one beginning with "header" shown above. The code is full of comments, so I will clean those out and see what happens. I thought there might be a troubleshooting method but perhaps not. Thank you for the posts. Quote Link to comment https://forums.phpfreaks.com/topic/57159-solved-cannot-modify-header-information-headers-already-sent-by/#findComment-282696 Share on other sites More sharing options...
trq Posted June 26, 2007 Share Posted June 26, 2007 Remove... echo " No records were found. "; You cannot have ANY output before a call to header(). Why would you need to? Your redirecting anyway, makes no sense. Quote Link to comment https://forums.phpfreaks.com/topic/57159-solved-cannot-modify-header-information-headers-already-sent-by/#findComment-282699 Share on other sites More sharing options...
suma237 Posted June 26, 2007 Share Posted June 26, 2007 hey, remove the echo statement or instead of header write javascript to redirect Quote Link to comment https://forums.phpfreaks.com/topic/57159-solved-cannot-modify-header-information-headers-already-sent-by/#findComment-282706 Share on other sites More sharing options...
HowdeeDoodee Posted June 27, 2007 Author Share Posted June 27, 2007 You are all correct on eliminating the echo statements. I had tons of them and was not aware of the header vs. echo issue. Although now it makes sense since an echo brings up a page. Thank all of you who posted. Freaks rule again!!!! Quote Link to comment https://forums.phpfreaks.com/topic/57159-solved-cannot-modify-header-information-headers-already-sent-by/#findComment-283538 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.