what you would need to do for the query you are doing is:
try{
$pds= $pdo->prepare("SELECT * FROM userinfo WHERE username=:username AND password=:password");
$pds->execute(array(':username' => $username, ':password' => $password));
}
catch(PDOException $ex){
die("Failed to run query: " . $ex->getMessage());
//Or Echo, or store in a variable to process if you don't want to die()
}
$row = $pds->fetch(PDO::FETCH_ASSOC);
Hope this helps!
Edit:
Also, if you want a bit more separation and readability for building a query you can try creating a query parameter array instead of creating the array directly in the execute() function.
$pds = $pdo->prepare("SELECT * FROM userinfo WHERE username=:username AND password=:password");
$query_params = array(
':username' => $username,
':password' => $password
);
$result = $pds->execute($query_params);