Jump to content

[SOLVED] Cannot modify header information - headers already sent by...


Recommended Posts

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.

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!!!!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.