View Full Version : Adding Date/Time User Logs Into Site...

03-01-2007, 04:01 PM
Hi all,
I want to be able to sort my users by the top 5 most active... Or the last 5 users to logon... I have added a DATETIME column to my MySQL members table... Just not sure what I now put on the home.php file, so it records the DATETIME into the table automatically... Any help would be greatly appreciated!

03-01-2007, 04:05 PM
For top 5 active, you'd have to define active. I'd advise against updating the database for every pageview. For instance, if it is a forum you could record when they last replied or posted a new topic. Then use that as the top 5 active.

For last 5 logons, just update the datetime column upon login.

Then query the database ordering by the datetime.