Skip to content

Instantly share code, notes, and snippets.

Created July 12, 2010 17:46
Show Gist options
  • Save anonymous/472797 to your computer and use it in GitHub Desktop.
Save anonymous/472797 to your computer and use it in GitHub Desktop.
$query = "SELECT mapid, kills, games, connections FROM ps_c_map_data ORDER BY 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);
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