I'm working in this project that is an Android login app. It fetches data from an online server.
The registration works and the database gets updated but the login does not work. We are using JSON to parse data from the server to the app.
Here is my PHP code:
public function getUserByEmailAndPassword($email, $password) {
$stmt = $this->conn->prepare("SELECT * FROM user_info WHERE email = ?");
$stmt->bind_param("s", $email);
if ($stmt->execute()) {
$user = $stmt->bind_result()->fetch_assoc();
$stmt->close();
return $user;
}
else {
return NULL;
}
}
The error I'm getting is the following:
Fatal error: Call to a member function fetch_assoc() on a non-object.