PHP session variable changes everytime a different user logs in

So i’m doing this project guys, and i’m using session variable to get the user ID everytime a user logs in. Problem is, when i tried using 2 browsers to view my project, the value of the session variable changes to whichever ID i signed in.

Let’s say i signed in ID# 123 first. Then i signed in 234 second. So now the session variable is now 234.

Is it possible that the value of the session variable won’t change every login? Let’s say 123 logs in, then he holds that value until he logs out.

Sorry i’m an inexperienced PHP developer. Thanks!

Both browsers should retain their own session store so if browser 1 is changed because you log in with browser 2 something is definitely wrong

1 Like

I’ll follow what Jim stated. A session is limited to a browser session, not the server code. If you are somehow updating a different session, there is definitely an issue that needs addressed.

How are you determining that the session is different for these cases?

Thats normal,last session is always on.

Sponsor our Newsletter | Privacy Policy | Terms of Service