<?php
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: *");
header('Content-Type: application/json');
include '../db/connectMe.php';
include '../function/function.php';

if (isset($_GET["c"])) {
    $clubId = mysql_prep($_GET['c']);

    // Get all statistic types
    $statTypes = find_all_statistic_types(1);
    
    $stats = []; 

    foreach ($statTypes as $statType) {
        $code = $statType->code; 

        $clubStats = find_all_other_club_stats_for_type($clubId, $statType->id, 1);

        $stats[$code] = $clubStats;
    }

    exit(json_encode($stats));
}