title: PHP Password_verify always showing false
body: <p>I know that theres been multiple questions asked in regards to PHP password_verify, however I did not see any answers that applied or worked in my situation.</p>
  <p>I am storing a password in my database with the following code</p>
  <pre><code>$pwhash = password_hash(&quot;test123&quot;,PASSWORD_DEFAULT);
  $sql = &quot;INSERT INTO creds (Username, Password, IsAdmin) VALUES('mtpotts','$pwhash' , 1)&quot;;
  $conn-&gt;exec($sql);
  </code></pre>
  <p>Which will store for example
  &quot;$2y$10$CfV8ZZZLWtfADpmgOg4d5OUw56sEHo2EF5pQr33jTEZdPj9LZXUkG&quot;</p>
  <p>Running that through a character counter I get 60 letters. If I check the data base I have
  &quot;$2y$10$CfV8ZZZLWtfADpmgOg4d5OUw56sEHo2EF5pQr33jTEZdPj9LZXUkG&quot; So I can see that the database isn't setup too small to hold the 60 characters.</p>
  <p>On my login page I have the following code</p>
  <pre><code>$user = htmlspecialchars($_POST[&quot;fname&quot;] ?? &quot;&quot;, ENT_QUOTES);
  $plaintextpass = htmlspecialchars($_POST['pword'] ?? &quot;&quot;, ENT_QUOTES);
  try {
  $conn = new PDO(&quot;mysql:host=$servername;dbname=Username&quot;, $username,$password);
  
  $conn-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  echo &quot;&lt;br&gt;Connected&lt;br&gt;&quot;;
  } catch (PDOException $e) {
      echo &quot;Connection failed&quot; . $e-&gt;getMessage();
  }
  $query1 = &quot;SELECT * FROM creds WHERE username='$user'&quot;;
  $stmt= $conn-&gt;prepare($query1);
  $stmt-&gt;execute($data);
  $count1 = $stmt-&gt;fetchall();
  $count1 = count($count1);
  if($count1 == 1){
      $query = &quot;SELECT Password FROM creds WHERE username='$user'&quot;;
      $statement = $conn-&gt;prepare($query);
      $statement-&gt;bindParam(':user', $user);
      $statement-&gt;execute();
      foreach ($conn-&gt;query($query) as $row) {
          $result2 = $row['Password'] . &quot;\t&quot;;
      }
      if(password_verify($plaintextpass,$result2)){
          //$seconds = 120 + time();
          echo(&quot;MATCH&quot;);
          //setcookie(loggedIn, date(&quot;F js - g:i a&quot;), $seconds);
          //header(&quot;location:login_success.php&quot;);
      }else{
          echo &quot;&lt;br&gt;Invalid info1&quot;;
          echo( &quot;&lt;br&gt; &lt;br&gt; we received $result2 &lt;br&gt; you sent $plaintextpass&quot;);
      }
  }
  else{
          echo &quot;Invalid info2&quot;;
  }
  </code></pre>
  <p>I am so new to this that I am certain it's my fault and not the language. Also I am aware that I'm not advised to use password_hash. I'm doing it for simplicity at the moment and this is only a test environment for learning.</p>