Jump to content

Help with this error msg..


kevinkhan

Recommended Posts

Im getting this error message when i run a script.

 

Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\widgetCorp\stage5\includes\connection.php:17) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\widgetCorp\stage5\create_subject.php on line 18

 

what does this actually mean?

 

THis is the code  in create_subject.php

 

$query = "INSERT INTO subjects (
              menu_name, position, visible
              ) VALUES (
                '{$menu_name}', {$position}, {$visible}
              )";
        if(mysql_query($query, $connection))
          {
            // Success
            header("Location: content.php");
            exit; 
            // always need exit when sending header information
          }
        else
          {
          // Display error message
          echo "<p>Subject creation failed.</p>";
          echo "<p>" . mysql_error() . "</p>";
          }

 

 

Thanks for any help given..

Link to comment
https://forums.phpfreaks.com/topic/181596-help-with-this-error-msg/
Share on other sites

And since the error message states where the output is occurring at that is preventing the headers from working -

output started at ....\connection.php:17 (line 17)

 

You would need to determine what connection.php is doing on line 17 that is producing output and either eliminate it (assuming it is unintentional) or rearrange your logic (assuming the output is intentional) so that the output occurs after the header() statement or the header() statement is before the code sending the output.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.