Skip to content

Instantly share code, notes, and snippets.

@gsmcwhirter
Forked from anonymous/gist:472797
Created July 12, 2010 18:05
Show Gist options
  • Save gsmcwhirter/472828 to your computer and use it in GitHub Desktop.
Save gsmcwhirter/472828 to your computer and use it in GitHub Desktop.
<?php
$query = "SELECT mapid, kills, games, kills/games as kpg, connections, connections/games as cpg FROM ps_c_map_data ORDER BY kpg IS NOT NULL DESC, kpg DESC, games desc";
$result = mysql_query($query)
or die('Sorry, we could not retrieve pending from the database. Please try again.');
$totalmaps = mysql_num_rows($result);
while ($row=mysql_fetch_array($result, MYSQL_ASSOC))
{
$mapid = $row['mapid'];
$kills = (int)$row['kills'];
$games = (int)$row['games'];
$connections = (int)$row['connections'];
//$kills_per_game = $kills / $games;
//$kills_per_game = round($kills_per_game,2);
//$conn_per_game = $connections / $games;
//$conn_per_game = round($conn_per_game,2);
$kills_per_game = round($row['kpg'] ? $row['kpg'] : 0, 2);
$conn_per_game = round($row['cpg'] ? $row['cpg'] : 0, 2);
if ($games >= 100)
{
$query2 = "SELECT uniqueid FROM ps_map WHERE mapid='$mapid'";
$result2 = mysql_query($query2)
or die('Sorry, we could not retrieve pending from the database. Please try again.');
$row2=mysql_fetch_array($result2, MYSQL_ASSOC);
$map = $row2['uniqueid'];
echo "<tr>\n";
echo "<td>$map</td>\n";
echo "<td>$games</td>\n";
echo "<td>$kills_per_game</td>\n";
echo "<td>$conn_per_game</td>\n";
echo "</tr>\n";
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment