title: not functioning in while($row->$statement->fetch()) using php PDO
body: <pre><code>if(isset($_POST['btnLogin']))
  {
  $username = $_POST['txtusername'];
  $pass_word = $_POST['txtpassword'];
  $hashed_password = crypt(sha1($pass_word));
  
  
  $sqlQuery  = "SELECT * from users WHERE username = :username AND password = :password" ;
  $statement = $conn-&gt;prepare($sqlQuery);
  $statement-&gt;execute(array(':username' =&gt;$user , ':password'=&gt;$hashed_password));
  
  while($row-&gt;$statement-&gt;fetch())
  {
      $id       = $row['id'];
      $username = $row['username'];
      $password = $row['password'];
  
      if(strcmp('$password', '$hashed_password') == 0)
      {
          echo "&lt;script type='text/javascript'&gt;console.log("Sucess");&lt;/script&gt;";
      }
      else
      {
          echo "&lt;script type='text/javascript'&gt;console.log("Failed");&lt;/script&gt;";
      }
  
  }
  
  }
  </code></pre>
  
  <p><strong>In here I am implementing the Sign in a page using PHP PDO codes.
  I have no previous experience in using PHP PDO.I do the Sign up page without any errors but unfortunately program is not execute after</strong></p>
  
  <blockquote>
    <p><em>while($row->$statement->fetch())</em></p>
  </blockquote>
  
  <p>here are the HTML codes</p>
  
  <pre><code>&lt;section&gt;
  
      &lt;div class="container"&gt;
          &lt;div class="login-form"&gt;
              &lt;h1&gt;Sign In&lt;/h1&gt;
              &lt;form id="login-form" method="post" action=""&gt;
              &lt;div class="form-group"&gt;
                  &lt;input type="text" name="txtusername" placeholder="Username" data-validation="required"&gt;
              &lt;/div&gt;
              &lt;div&gt;
                  &lt;input type="password" name="txtpassword" placeholder="Password" data-validation="required"&gt;
              &lt;/div&gt;
                  &lt;input type="submit" name="btnLogin" value="Login"&gt;
              &lt;/form&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/section&gt;
  </code></pre>
  
  <p><strong>PHP VERSION : 5.3.8</strong></p>
  
  <p>Please give any suggestion to me for solve it</p>