How to automatically update column in database
Given below is an algorithm to implement what you have asked yesterday and today including this question
Algorithm starts -
When user fills the user-ID and Password in login form -
Check the user-ID && password both are correct.
If both are correct then check `session_id == 0` in database If true then set session_id = 1 in database and login that user. If false then redirect back to home page or give him/her an alert message('you can't login now because your account is already logged in another browser'). **Note :** You can also show the message as user's (which is already loggedin) browser name, IP address, First loggedin time/date etc.
If both (user-ID and Password) are NOT correct then
show the error message('userID or Password is not correct').
When User tries to logout then, the very first thing you must do that (important)
Set session_id = 0 in database. then logout that user.
Algorithm ends -
What does this algorithm do ?
If you already logged-in in a browser then you can't login again in different browser until you logged out from the original browser.