title: PHP not getting User data from database when data is already in database
body: <p>This is the code ! PHP not getting User data from database when data is already in database ! Help me , i am stuck. When i Enter details in login.php it redirects me to login.php?invalid=1 and shows error of incorrect information or session expired ! Despite the information is same !</p>
  
  <pre><code>&lt;?php 
      session_start();
      include_once("include\config.php");
      $login = $_POST["textfield1"];
      $pwd = $_POST["textfield2"];
      $recordset = mysql_query("select * from users");
      while($record = mysql_fetch_array($recordset)){
      if($login == $record["ulogin"] &amp;&amp; $pwd == $record["upassword"]) {
          $_SESSION["ulogin"] = $record["ulogin"];
          $_SESSION["uid"] = $record["uid"];  
          if($record["utype"] == 1){
                  $_SESSION["utype"] = $record["utype"];
                  header("Location:admin.php?uid=".$record["uid"]);
                  exit;
          }else{
                  header("Location:home.php");
                  exit;
              }
          }
      }
      header("Location:login.php?invalid=1");
  ?&gt;
  </code></pre>