ShoeLace1291 Posted July 8, 2009 Share Posted July 8, 2009 I have a database that stores member information in a table called `members` with a column that shows when they were last active called `lastActive`. The lastActive column is a strtotime date and time string like strtotime(date("M jS, o g:i a")) How would I list the users that have been active in the last 15 minutes? Link to comment https://forums.phpfreaks.com/topic/165276-users-online/ Share on other sites More sharing options...
p2grace Posted July 8, 2009 Share Posted July 8, 2009 I'd recommend also storing a last active datetime field... more practical and functional Link to comment https://forums.phpfreaks.com/topic/165276-users-online/#findComment-871575 Share on other sites More sharing options...
ShoeLace1291 Posted July 8, 2009 Author Share Posted July 8, 2009 Ok, so how would I print the time that it would be 15 minutes before the current time? Link to comment https://forums.phpfreaks.com/topic/165276-users-online/#findComment-871580 Share on other sites More sharing options...
p2grace Posted July 8, 2009 Share Posted July 8, 2009 You'd have to create a comparison variable in php to use in the sql statement. Something like the following should do the trick. <?php $compare_time = date("Y-m-d H:m:s",mktime(date("H"),date("m") - 15,0,date("m"),date("d"),date("Y"))) ?> Link to comment https://forums.phpfreaks.com/topic/165276-users-online/#findComment-871589 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.