Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- $db_host = "localhost";
- $db_name = "";
- $db_user = "";
- $db_pw = "";
- if (isset($db_host, $db_user, $db_pw, $db_name)) {
- mysql_connect($db_host, $db_user, $db_pw) OR die("Cannot connect to your database!");
- mysql_select_db($db_name) OR die("Cannot connect to your database!");
- }
- ?>
- <?
- echo "<center>";
- echo '<h2>- Stats -</h2><br />';
- $query = "SELECT Name,Kills,Deaths,Tks FROM players ORDER BY `id` LIMIT 50";
- $result = mysql_query("$query")
- or die("Table Content Request Failed: " . mysql_error());
- echo "<div class=\"bodycontent\"><table>\n\t\t\t<tr>\n";
- echo "\t\t\t\t<td style=\"padding-right:15px; margin-right: 120px\"><b><font size='3.5' color=#000>#</font></b></td>\n";
- for ($i = 0; $i < mysql_num_fields($result); $i++)
- {
- echo "\t\t\t\t<td style=\"padding-right:20px; margin-right: 120px\"><b><font size='3.5' color=#000>" . mysql_field_name($result, $i) . "</font></b></td>\n";
- }
- echo "\t\t\t\t<td style=\"padding-right:15px; margin-right: 120px\"><b><font size='3.5' color=#000>Ratio</font></b></td>\n";
- echo "\t\t\t</tr>\n";
- $count = 1;
- while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
- {
- echo "\t\t\t<tr>\n";
- echo "\t\t\t\t<td style=\"padding-right:10px; margin-right: 10px\"><font size='3.5' color=#000>".$count.")</font></td>\n";
- echo "\t\t\t\t<td style=\"padding-right:10px; margin-right: 10px\"><font size='3.5'>".$row['Name']."</font></td>\n";
- echo "\t\t\t\t<td style=\"padding-right:10px; margin-right: 10px\"><font size='3.5' color=#000>".$row['Kills']."</font></td>\n";
- echo "\t\t\t\t<td style=\"padding-right:10px; margin-right: 10px\"><font size='3.5' color=#000>".$row['Deaths']."</font></td>\n";
- echo "\t\t\t\t<td style=\"padding-right:10px; margin-right: 10px\"><font size='3.5' color=#000>".$row['Tks']."</font></td>\n";
- if($row['Kills'] == 0 || $row['Deaths'] == 0) $ratio = "N/A"; else $ratio = round($row['Kills']/$row['Deaths'],2);
- echo "\t\t\t\t<td style=\"padding-right:10px; margin-right: 10px\"><font size='3.5' color=#000>".$ratio."</font></td>\n";
- echo "\t\t\t</tr>\n";
- $count++;
- }
- echo "\n\t\t</table>\n</div>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement