title: Login accepted and failed?
body: <p>Hello everybody I am trying to make a login script in PHP.. it works well i am able to login but i got this strange bug or whatever to call it... you see when i login as an ordinary user it works fine, but when i login as admin i get loged in but in the same time it says my login failed... </p>
  
  <p>I got this welcome message: </p>
  
  <pre><code>&lt;?php echo "&lt;h3 id ='tjena'&gt; Welcome ".$_SESSION['user']."&lt;/h3&gt;";?&gt;
  </code></pre>
  
  <p>so i know that i am actully logged in... 
  However i also got a header which are supposed to lead me to ?success but of some reason it fails and directs me to ?error</p>
  
  <p>Here is my code:</p>
  
  <pre><code>while($row = $result-&gt;fetch_object()) {
      if($username == $row-&gt;username) {
          $checkPassword = password_verify($password,$row-&gt;password);
          if($checkPassword ){   
              session_start();
              $_SESSION['loggedIn'] = true; 
              $_SESSION['user'] = $row-&gt;username;
              $_SESSION['admin'] = $row-&gt;admin;
              $_SESSION['LAST_ACTIVITY'] = time(); 
              header("Location:index.php?success");
              $fail = false;
          }
      } else {
          $fail = true;
      }
  }
  
  if($fail){      
      header("Location:index.php?error");
  }
  </code></pre>
  
  <p>Does somebody know what is causing this error? Thans in advance!</p>