getColumn(" SELECT DISTINCT start_date FROM session_weight WHERE session_id = $session_id ORDER BY start_date "); $date_default = $db->getColumn(" SELECT DISTINCT start_date FROM session_weight WHERE session_id = $session_id AND week(start_date) < week(now()) ORDER BY start_date DESC "); if(!$date_default) $date_default = array($dates[0]); $start_date = form_array($dates, "date", $date_default[0]); function getWeekLeader($start_date, $part_min, $part_max, $session_id){ global $db; $row = $db->getRow(" SELECT sw.*, c.start_weight, (100 * weight / c.start_weight * if(sw.direction = 'gained', -1, 1)) percent, CONCAT_WS(' - ', c.name, c.team_name) name FROM session_weight sw, competitor c WHERE sw.competitor_id = c.id AND sw.start_date = '$start_date' AND participants >= $part_min AND participants <= $part_max AND sw.session_id = $session_id AND sw.direction IN ('lost', 'gained') ORDER BY percent DESC LIMIT 1 "); if(!$row){ $row['name'] = 'No data'; $row['percent'] = false; } return $row; } header('Cache-Control: no-cache'); header('Pragma: no-cache'); ?>
10 and Under Participating EmployeesCompany % Weight Loss
%
11 - 29 participating EmployeesCompany % Weight Loss
%
30 - 59 Participating EmployeesCompany % Weight Loss
%
60+ Participating EmployeesCompany % Weight Loss
%