Trying to convert from mysqli to pdo
<pre><code>try {
$pdo = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbusername, $dbpassword);
} catch (PDOException $e){
exit('Datebase error.');
}
// db login info is already defined, just didnt post it here

$username = $_GET["user"];
$password = $_GET["passwd"];
//$data = mysqli_query($mysqli, "SELECT * FROM users WHERE username='".$username."'");
//$hash = mysqli_fetch_object($data);
$query = "SELECT username, password, loginreqkey, banned FROM users WHERE username='$username'";

//if (password_verify('rasmuslerdorf', $hash)) {
if ($stmt = $pdo-&gt;prepare($query)) {
$stmt-&gt;execute(array($username, $password, $loginreqkey, $banned));
//$stmt-&gt;bind_result($username, $password, $loginreqkey, $gbanned);
//  $result = $stmt-&gt;fetch(PDO::FETCH_LAZY);
//$dt = $stmt-&gt;fetchAll()   ;
 //$query-&gt;execute(array($username, $password));
if (password_verify($password, $result['password'])) {

while($r = $stmt-&gt;fetchAll(PDO::FETCH_ASSOC)){
 echo "{";
 echo '"state": "success",';
    echo '"loginreqkey": "' . $r['loginreqkey'] . '",';
     echo '"banstatus": "' . $r['banned'] . '"';
    echo "}";
}

/* close statement */
$stmt = null;
} else {
die("fake pw lol");
}

/* close connection */
$pdo = null;
}
//}
</code></pre>

<p>Trying to convert my code from MySQLi to PDO and having issues.. trying to get all the information in query and verify the user password then echo the rest of the information, (for an unreal project) tried a couple of solutions on php documentation and stackoverflow but they were usually just for sending information to the mysql server.</p>