kinks Posted August 31, 2009 Share Posted August 31, 2009 Okay. In my MySQL databse, I have my users table, and I want a 'last login' for each user. How can I make it register each person's last login? Quote Link to comment Share on other sites More sharing options...
BLaZuRE Posted August 31, 2009 Share Posted August 31, 2009 Whenever you login update a column for `last_login` to the current date/time. You'll have to first decide what you're using to store dates and times in. Will you use a timestamp? datetime? Whatever you're using, update the field using NOW() or whatever's appropriate. Now, you've got when the login occurred, which you can grab the next time you login (remember to grab the data as a variable BEFORE you update it, so you can display it). Quote Link to comment Share on other sites More sharing options...
kinks Posted August 31, 2009 Author Share Posted August 31, 2009 Whenever you login update a column for `last_login` to the current date/time. You'll have to first decide what you're using to store dates and times in. Will you use a timestamp? datetime? Whatever you're using, update the field using NOW() or whatever's appropriate. Now, you've got when the login occurred, which you can grab the next time you login (remember to grab the data as a variable BEFORE you update it, so you can display it). Thank you! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.