I am relatively new to using PHP and MySQL and have run into trouble with the following code.
$stmt = $this->conn->prepare("SELECT * FROM users WHERE user_name = ?");
$stmt->bind_param("s", $username);
if ($stmt->execute()) {
$user = $stmt->get_result()->fetch_assoc();
$stmt->close();
return $user;
}
The error:
Call to undefined method mysqli_stmt::get_result() is produced on the running of this script presumably due to MAMP not supporting mysqlnd
. I have tried to work out how to install the native driver to MAMP but it does not look possible - (I have submitted a bug report and would suggest other MAMP users do so as well).
The line below seems to be the issue:
$user = $stmt->get_result()->fetch_assoc();
Can anyone suggest an alternative method of producing the same outcome but without mysqlnd
?
Many thanks.