<?php header('Content-type: application/json;'); include_once 'domain/Club.php'; include_once 'domain/Player.php'; include_once 'domain/Statistics.php'; include_once 'util/Response.php'; include_once 'database/DatabaseBroker.php'; $json = "{\n\t\t\"cols\":[\n\t\t{\"label\":\"Player\", \"type\":\"string\"},\n\t\t{\"label\":\"Appearances\", \"type\":\"number\"},\n\t\t{\"label\":\"Goals\", \"type\":\"number\"} \n\t\t],\n\t\t\"rows\":[\n\t\t"; $db = new DatabaseBroker(); $db->openConnection(); $club_id = $_GET['club_id']; $stats = $db->generateChartStatistics($club_id); $db->closeConnection(); foreach ($stats as $s) { $json .= "{\"c\":[{\"v\":\"{$s->getPlayer()->getPlayerName()}\"},{\"v\":{$s->getAppearances()}}, {\"v\":{$s->getGoals()}}]},"; } $json = substr($json, 0, -1); $json .= "]}"; echo $json;