title: Reason for: Trying to get property of non-object in php
body: <pre><code>    if(isset($_POST['uname'])) 
      {       
          $query = "SELECT * FROM user_info";
          $res = $mysqli-&gt;query($query);
          $num = $res-&gt;num_rows;
          $i = 0;     
          $cpwd = $_POST["pswd"];
          $hpwd = SHA1($cpwd);
          $tmp = $_POST["uname"]; 
          while($i &lt; $num)
          {
              $row = $res-&gt;fetch_object();
              $name = $row-&gt;Username;
              $pwd = $row-&gt;Password;  
              if($name == $tmp)
              {       
                     //check if user is blocked
              }
              //hashed pwd
              if($pwd == $hpwd)
              {   
                  //success
                  exit();
              }   
              //request for pwd change
          else if($pwd == $cpwd)
              {
              //change
                  exit();
              }
              else if($pwd != $hpwd)
              {
  
                  //incorrect pwd
              }
          }
          $i++;
      }
      if($i == $num)
      {
          //new user
      }
  }
  </code></pre>