コード例 #1
0
ファイル: Score.php プロジェクト: rryanburton/Tsoha-Bootstrap
 public static function all_game_scores($gameid)
 {
     $players = Game::games_players($gameid);
     $player_scores = array();
     foreach ($players as $player) {
         $sql = "SELECT * FROM score WHERE gameid = :gameid AND playerid = :playerid";
         $query = DB::connection()->prepare($sql);
         $query->execute(array('gameid' => $gameid, 'playerid' => $player->playerid));
         $rows = $query->fetchAll();
         $scores = array();
         foreach ($rows as $row) {
             $score = new Score(array('scoreid' => $row['scoreid'], 'gameid' => $row['gameid'], 'holeid' => $row['holeid'], 'playerid' => $row['playerid'], 'stroke' => $row['stroke'], 'ob' => $row['ob']));
             $score->prepare();
             $scores[] = $score;
         }
         $player_scores[$player->firstname] = $scores;
     }
     return $player_scores;
 }