I wanted to know a good and efficient way to be able to tell how long ago my users last logged in.
On the users profile I want it for say how long ago their last log in was.
Eg:
User 1 Last login: 2 hours ago
User 2 Last login: 3 minutes ago
User 3 Last login: 2 months ago
I will keep their last login information in a MySQL database but want to know how to do the script.
I just realized that Stackoverflow uses this feature, so that can help you understand what I want.
mysql_query("UPDATE users SET lastactivity = ".time()." WHERE id = ".$userID);
This is how I will update the DB.