County Teams Stats

Order by:      Played      Won %      Games Won      Aggregate

[insert_php]
function getPlayerLink($player)
{
return “$player“;
}

Global $league;
try
{
$mode = $_GET[“mode”];
if(is_null($mode)) { $mode = “Aggregate”; }
$dbh = new PDO(getConnString(), getUser(), getpw());
$dbh->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
if($league !== null) {$sqlTeams = “SELECT oidleague, day as \”Team\” FROM league where oidleague = $league”;}
else {$sqlTeams = “SELECT oidleague, day as \”Team\” FROM league where oidleague <> 1″;}
foreach ($dbh->query($sqlTeams) as $rowTeam)
{
echo “

“.$rowTeam[‘Team’].” Top Stats

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;

$mod = “rowEven”;
$oidleague = $rowTeam[‘oidleague’];
$sqlPlayers = “SELECT * FROM playerstats WHERE oidleague = $oidleague and played >= 5 ORDER BY $mode DESC limit 10”;
foreach ($dbh->query($sqlPlayers) as $rowStats)
{
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
if($mod == “rowEven”) { $mod = “rowOdd”; }
else { $mod = “rowEven”; }
}
echo “

PlayerPldW%WonFirstLastAgg
“.getPlayerLink($rowStats[‘homeplayer’]).”“.$rowStats[‘played’].”“.round($rowStats[‘wp’],1).”%“.$rowStats[‘won’].”“.date(“jS M Y”, strtotime($rowStats[‘firstplayed’])).”“. date(“jS M Y”, strtotime($rowStats[‘lastplayed’])).”“.$rowStats[‘aggregate’].”

“;
}
$dbh = null;
}
catch(PDOException $e) { echo $e; }
[/insert_php]