示例#1
0
            case 'getPlayers':
                // get players list from database
                $clubId = $_GET['clubId'];
                $players = $db->getPlayers($clubId);
                $response->setSuccesfull(true);
                $response->setValue($players);
                break;
            case 'getPlayerStatistics':
                // get statistics for the of the single player
                $playerId = $_GET['playerId'];
                $stat = $db->getStatisticsByPlayerId($playerId);
                $response->setSuccesfull(true);
                $response->setValue($stat);
                break;
            case 'getAllPlayersStatistics':
                $statistics = $db->getStatisticsByClubId($_GET['clubId']);
                $response->setSuccesfull(true);
                $response->setValue($statistics);
                break;
        }
    } catch (Exception $e) {
        // set json response value
        $response->setSuccesfull(false);
        $response->setMessage('Error! ' . $e->getMessage());
    } finally {
        $json = json_encode($response);
        echo $json;
        $db->closeConnection();
    }
}
if (isset($_POST['func'])) {