Advertisement
Guest User

rankings.php

a guest
Mar 28th, 2013
1,548
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include("header.php");
  4. if(!isset($_SESSION['uid'])) {
  5. echo "You must be logged in to view this page";
  6. }else{
  7. ?>
  8. <center><h2>Battle Players</h2></center>
  9. <br />
  10. <table cellpadding="2" cellspacing="2">
  11. <tr>
  12. <td width="50px"><b>Rank</b></td>
  13. <td width="150px"><b>Username</b></td>
  14. <td width="200px"><b>Gold</b></td>
  15. </tr>
  16. <?php
  17. $get_users = mysql_query("SELECT `id`,`overall` FROM `ranking` WHERE `overall`>'0' ORDER BY `overall` ASC") or die(mysql_error());
  18. while($row = mysql_fetch_assoc($get_users)) { var_dump($row)
  19. echo "<tr>";
  20. echo "<td>". $row['overall']. "</td>";
  21. $get_user = mysql_query("SELECT `username` FROM `user` WHERE `id`='".$row['id']."'") or die(mysql_error());
  22. $rank_name = mysql_fetch_assoc($get_user);
  23. echo "<td><a href=\"stats.php?id=" .$row['id']."\">" . $rank_name['username'] . "</a></td>";
  24. $get_gold = mysql_query("SELECT `gold` FROM `stats` WHERE `id`='".$row['id']."'") or die(mysql_error());
  25. $rank_gold = mysql_fetch_assoc($get_gold);
  26. echo "<td>" . number_format($rank_gold['gold']) . "</td>";
  27. echo "</tr>";
  28. }
  29. ?>
  30. </table>
  31. <?php
  32. }
  33. include("footer.php");
  34. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement