Hello I am trying to make a login app using android and php running on an ec2 instance, but I cant login even if I put the right credentials.
So I started printing the query and if I print $user all I get is "1" any suggestions?
public function getUserByEmailAndPassword($email, $password) {
$stmt = $this->conn->prepare("SELECT * FROM users WHERE email=?");
$stmt->bind_param('s', $email);
if ($stmt->execute()) {
$stmt->bind_result($id,$unique_id,$name,$email,$encrypted_password,$salt,$created_at,$updated_at);
$user = $stmt->fetch();
$stmt->close();
// verifying user password
$salt = $user['salt'];
$encrypted_password = $user['encrypted_password'];
$hash = $this->checkhashSSHA($salt, $password);
// check for password equality
if ($encrypted_password == $hash) {
// user authentication details are correct
return $user;
}
} else {
return null;
}
}
fetch(), which is true/1 if successfull.