title: Whats the proper way to use password_verify with PDO?
body: <p>I can't seem to get password_verify to work w/in my php PDO code.  My pass field is stored as varchar(255). I've been reading similar questions, but from what I can tell I have it set up right.  I must still be missing something.
  My registration page is as follows..</p>
  
  <pre><code>$user = $_POST['username']
  $pass = $_POST['pass'];
  $passH = password_hash($pass, PASSWORD_DEFAULT);
  $query = $con-&gt;prepare("INSERT INTO emps (user, pass) VALUES (?, ?)");
  $query-&gt;execute([$user, $passH]);
  </code></pre>
  
  <p>An encrypted password is now successfully stored in my database.</p>
  
  <p>My Login Page is as follows..</p>
  
  <pre><code>if(isset($_POST['login'])) {
    $username = $_POST['username'];
    $pass = trim($_POST['pass'];
    $passH = password_hash($pass, PASSWORD_DEFAULT);
    $sel_user = $con-&gt;prepare("SELECT id, username, pass, gid FROM emps WHERE gid!=4 AND username=?");
    $sel_user-&gt;execute([$username]);
    $check_user=$sel_user-&gt;fetch();
    if(count($check_user)&gt;0 &amp;&amp; password_verify($passH, $check_user['pass'])) {
      $_SESSION['username']=$check_user['username'];
      header("Location: xadmin.php");
      exit;
    }
    else {
      echo "&lt;script&gt;alert('Not Found')&lt;/script&gt;";
  </code></pre>
  
  <p>Body of Login Page..</p>
  
  <pre><code>&lt;form action="login.php" method="post"&gt;
      &lt;table width="100%" border="0"&gt;
          &lt;tbody&gt;
              &lt;tr&gt;
                  &lt;td bgcolor="#3B3B3B" height ="35" class="BodyTxtB" align="center"&gt;Administrator Login&lt;/td&gt;&lt;/tr&gt;
              &lt;tr height="20"&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
              &lt;tr&gt;
                &lt;td class="BodyTxtB" align="center"&gt;Username&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                &lt;td class="BodyTxtB" align="center"&gt;&lt;input type="text" class="BodyTxtBC" name="username" required="required"/&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr height="20"&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
              &lt;tr&gt;
                &lt;td class="BodyTxtB" align="center"&gt;Password&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                &lt;td class="BodyTxtB" align="center"&gt;&lt;input type="password" class="BodyTxtBC" name="pass" required="required"/&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr height="20"&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
              &lt;tr height="35"&gt;&lt;td align="center"&gt;&lt;input type="image" src="images/btn_login.jpg" name="login" value="Login"/&gt;
              &lt;input type="hidden" name="login" value="Login" /&gt;&lt;/td&gt;&lt;/tr&gt;
              &lt;tr height="20"&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
           &lt;/tbody&gt;
       &lt;/table&gt;
     &lt;/form&gt;
  </code></pre>
  
  <p>Can anyone spot any errors?</p>