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? Link to comment https://forums.phpfreaks.com/topic/172509-solved-last-login/ 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). Link to comment https://forums.phpfreaks.com/topic/172509-solved-last-login/#findComment-909444 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! Link to comment https://forums.phpfreaks.com/topic/172509-solved-last-login/#findComment-909520 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.