I am trying to count users that are now online, so I made these 2 queries
When logging in
$id = $_SESSION['id'];
$up = mysqli_query($conn,"UPDATE user_account SET status= 1 WHERE id='$id'");
When logging out
$id = $_SESSION['id'];
$up = mysqli_query($conn,"UPDATE user_account SET status= '0' WHERE id='$id'");
0 value is for offline while 1 is for online so it works fine, but I tried this on incognito browser mode I logged in to an account then I closed the incognito browser mode and the seassion id still exists and never turn 0 is there is way I can prevent that?