rempires Posted July 9, 2007 Share Posted July 9, 2007 I'm making a site and i was going to keep track of how long users are logged in, originally i was going to use a TIME field, but my problem is would that be limited to 99hours, 59min 59seconds?? because the thing is users will most likely be logged in for hours at a time, I'm not to worried about this becoming a problem at first but in lets say a year or 2 from know what would happen if somone reached say 100 or more hours, what would mysql do?? should i instead switch to another field type to hold this data?? if somone could just tell me if this field can not handle anything bigger than this it would be appreciated, if somone has a suggestion about what to do instead I'd love to hear that to, as i was going to use a text field since I'll need to handle hours, min, seconds and just separate them with :, use explode in teh php to determine it all thanks, john Quote Link to comment Share on other sites More sharing options...
Yesideez Posted July 9, 2007 Share Posted July 9, 2007 Thought of using a field with datatype INT(11) unsigned? You can fill this with PHP's time() function. When they log in put the current time() into the table and work it from there. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 9, 2007 Share Posted July 9, 2007 you could use a 2 field system that says logged in, and then Last action page and then a comparrision of those values would get you the result (you can make them in terms of epoch seconds and then you have a results of $loggedininseconds = $lastaction-$loggedin; Just update the loggedin field when ever they "login" and I'd assume they have to log in when the session are destroyed 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.