"SELECT SUM(duration) AS total FROM `table_name` WHERE auth = '%s'", yourauthid);
Hook that into a TQuery on when the command is run, then format the seconds.
PHP Code:
if (SQL_FetchRow(hndl)) {
int I_Months, I_Weeks, I_Days, I_Hours, I_Minutes, I_Seconds;
I_Seconds = SQL_FetchInt(hndl, 0);
//Formating Seconds > Months ... etc
//Months
if (I_Seconds >= 2628000) {
I_Months = RoundToFloor(I_Seconds / 2628000.0);
I_Seconds = I_Seconds % 2628000;
}
//Weeks
if (I_Seconds >= 604800) {
I_Weeks = RoundToFloor(I_Seconds / 604800.0);
I_Seconds = I_Seconds % 604800;
}
//Days
if (I_Seconds >= 86400) {
I_Days = RoundToFloor(I_Seconds / 86400.0);
I_Seconds = I_Seconds % 86400;
}
//Hours
if (I_Seconds >= 3600) {
I_Hours = RoundToFloor(I_Seconds / 3600.0);
I_Seconds = I_Seconds % 3600;
}
//Minutes
if (I_Seconds >= 60) {
I_Minutes = RoundToFloor(I_Seconds / 60.0);
I_Seconds = I_Seconds % 60;
}
}
Messy code but I think you know what to do.
__________________