I am creating a php Rest API for my android application. I want to get all information of the logged user(logged in using his email and password). For this purpose I use $_SESSION['email'], but when I tried this using my app, didn't work. Can you please explain me how to use php session in android app. Thank you very much
function getLoggedUserInfo() {
$sql = "SELECT `id`,`name`, `gender` FROM users WHERE email=:email";
try {
$paramemail = $_SESSION['email'];
$dbCon = getConnection();
$stmt = $dbCon->prepare($sql);
$stmt->bindParam("email", $paramemail);
$stmt->execute();
$user = $stmt->fetchObject();
$dbCon = null;
echo json_encode($user);
} catch(PDOException $e) {
echo '{"error":{"text":'. $e->getMessage() .'}}';
}
}