title: Php login password_verify
body: <p>I am learning how to use prepared statements and I thought I would try out a login system (simple) using the <code>password_hash()</code> and <code>password_verify(</code>) functions. I have succesffuly inserted data in using prepared statemernts, now I wish to verify the password and do something with the user.</p>
  
  <p>I seem to be getting back my fail message at this stage:</p>
  
  <pre><code>$stmt = $conn-&gt;prepare("SELECT username, password FROM users WHERE username = ?");
  $stmt-&gt;bind_param('s', $username);
  
  $username = $_POST['ulogin'];
  $password = $_POST['upassword'];
  
  $stmt-&gt;execute();
  $stmt-&gt;bind_result($username, $password);
  
  
  
  $row = $stmt-&gt;fetch();
  if ($stmt-&gt;num_rows == 1) {
      if (password_verify($password, $row['user_password'])) {
          echo 'success';
      }
  } else {
   echo "Wrong data";
  }
  
  $stmt-&gt;close();
  $conn-&gt;close();
  </code></pre>
  
  <p>If I do a <code>var_dump($stmt-&gt;fetch());</code> and the login username is correct is comes back as <code>bool(true)</code></p>
  
  <p>Im not sure how to attempt to verify the password now.</p>