My question is fairly straightforward: Is it possible to use store_result()
and bind_result()
with PHP PDO?
Here is some example code I came across:
$stmt = $mysqli->prepare("SELECT id, username, password, salt FROM members WHERE email = ? LIMIT 1")) {
$stmt->bind_param('s', $email); // Bind "$email" to parameter.
$stmt->execute(); // Execute the prepared query.
$stmt->store_result();
$stmt->bind_result($user_id, $username, $db_password, $salt); // get variables from result.
$stmt->fetch();
I have seen these used in the context of mysqli
, but not with PHP PDO. store_result()
and bind_result()
are referenced in mysqli on www.php.net. I'm curious if they are valid, or if there are comparable methods.
Edit: Obviously there is some translation between the two methods. My assumption is that store_result
and bind_result()
are similar to PDO's fetch()
commands.