Loading ...
Sorry, an error occurred while loading the content.

Re: [bang-phpug] Warning : Headers already sent

Expand Messages
  • janakiraman
    Hi Bhatavanti, Whenever session are used the session_start() should be at starting of the program.  So please move the session_start() to the first line.
    Message 1 of 5 , Mar 9, 2010
    View Source
    • 0 Attachment
      Hi Bhatavanti,

      Whenever session are used the session_start() should be at starting of the program.  So please move the session_start() to the first line.

      Regards,
      Janakiraman.
      --- On Tue, 9/3/10, bhatavanti <bhatavanti@...> wrote:

      From: bhatavanti <bhatavanti@...>
      Subject: [bang-phpug] Warning : Headers already sent
      To: bang-phpug@yahoogroups.com
      Date: Tuesday, 9 March, 2010, 1:06 PM







       









      Hi,



      If I try to redirect a page to another page using Header(), I am getting warnings :



      Warning: session_start( ) [function.session- start]: Cannot send session cache limiter - headers already sent (output started at /home/content/ a/g/a/agani/ html/G/Mithaiwal e/testing/ l2.php:2) in /home/content/ a/g/a/agani/ html/G/Mithaiwal e/testing/ l2.php on line 16



      Warning: Cannot modify header information - headers already sent by (output started at /home/content/ a/g/a/agani/ html/G/Mithaiwal e/testing/ l2.php:2) in /home/content/ a/g/a/agani/ html/G/Mithaiwal e/testing/ l2.php on line 27



      Here is the code :



      <?PHP

      include("connect. php");

      $username = $_POST['username' ];

      $password = $_POST['password' ];

      $result=mysql_ query("select * from customerlogin where custname='$username ' AND custpassword= '$password' ");

      $rowCheck = mysql_num_rows( $result);



      //echo $rowCheck;

      if($rowCheck > 0)

      {



      // while($row = mysql_fetch_ array($result) )

      //{

      $login="success" ;

      session_start( );

      $_SESSION['loginid' ]=$username;



      } else {

      $login="fail" ;

      echo "Incorrect Username password";

      //header("Location: h.html");

      // echo $username;

      }



      if($login==" success") {

      header("Location: home.php");

      //echo "jgfuh";

      }

      ?>



      Please help























      Your Mail works best with the New Yahoo Optimized IE8. Get it NOW! http://downloads.yahoo.com/in/internetexplorer/

      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.