title: Warning: Cannot modify header information - headers already sent by
body: <pre><code>&lt;?php   session_start();
      include_once("include/Connection.php");
  
      $userid=$_POST['userid'];
      $password=$_POST['password'];
  
      $loginSql = "SELECT * FROM admin2 WHERE  admin_name='$userid' and admin_psw='$password'";
      $loginQuery=mysql_query($loginSql);
      $num_row = mysql_num_rows($loginQuery);
      $login = mysql_fetch_array($loginQuery);
  
      $user = $login['admin_name'];
      $password = $login['admin_psw'];
  
      echo $user;
      echo    $password;
  
      if($num_row &gt;0) 
      {
          if($user == $userid) 
          {
              $_SESSION['id_gosi'] = $login['id'];
              $_SESSION['userid_gosi'] = $login['admin_name'];
              header("Location: CustomerMaster.php");
              }
        else{
              header("Location: index.php?msg=2");
              exit();}}   
    else{
        header("Location: index.php?msg=1");
      }?&gt;
  </code></pre>
  
  <blockquote>
    <p>Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\php_mahavirbhadra\Admin\validate_login.php:17) in C:\wamp\www\php_mahavirbhadra\Admin\validate_login.php on line 26</p>
    
    <p>Warning: Unknown: 1 result set(s) not freed. Use mysql_free_result to free result sets which were requested using mysql_query() in Unknown on line 0</p>
  </blockquote>
  
  <p>when i write above code for admin login in php than connection successfully done but give me above error what can i do for this error ...Please give me solution....</p>