Currently I have a table in my database to store information related to each user, with each row represents a user. I hope to add two columns to it, one stores the most recent time when the user logs in, the other stores the most recent time when the user logs out.
As I'm relatively new to MySQL and PHP, I wonder what's the easiest way to store the current time in MySQL? Every time when a user logs in or logs out, I want to update the corresponding login/logout time column with the current time.
Can I compare the two timestamps using the method describe in question 1? I want to compare the last log in time with the last log out time in order to determine whether a user is currently logged in or not.
Thank you.