prepare('SELECT userId, password FROM users WHERE userName = :userName'); $stmt->execute(array( ':userName' => $userName )); $data = $stmt->fetch(PDO::FETCH_ASSOC); if($data == false){ //$errMsg = "User $username not found."; echo(0); }else { if( hash_equals($hashedPassword,$data['password'] ) ) { echo("valid"); exit; }else{ echo("d"); echo($hashedPassword . "
" . $data['password'] ); } } } ?>