On Mon, 2006-05-29 at 08:55, Ryan A wrote: > > Regardless of how you determine the end of the > > logged in time, you > > shouldn't track all the different sums in every > > entry since that's > > redundant. You don't even need the extra data since > > the database will > > happily allow you to perform the SUMs via queries. > > I have done very little SUM queries with time, can you > give me a quick example or any site where i can find a > few sample queries? This is basic MySQL so you should RTFM, and generally should be asking on a MySQL list :) SELECT SUM( UNIX_TIMESTAMP( logout_time ) - UNIX_TIMESTAMP( login_time ) ) AS seconds FROM some_table WHERE user_id = 1; If you have MySQL >= 4.1.1 then you should probably use the TIMEDIFF() function. Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php