Simple website with some JavaScript games.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.0 KiB

  1. <?php
  2. //5-17-17
  3. echo '<h1 class="w3-text-teal"><center>High Scores</center></h1>';
  4. $q = "select * from scores where game = '$game_id' order by score desc limit 20";
  5. $r = mysqli_query($dbc, $q);
  6. echo '<div class="w3-responsive w3-card-4"><table class="w3-table w3-striped w3-bordered"><thead>';
  7. echo '<tr class="w3-theme">
  8. <td>Rank</td>
  9. <td>User Name</td>
  10. <td>Score</td>
  11. </tr></thead><tbody>';
  12. $rank = 0;
  13. while($row = mysqli_fetch_array($r))
  14. {
  15. $rank ++;
  16. echo '<tr>';
  17. echo '<td>' . $rank . '</td>';
  18. echo '<td>';
  19. $q2 = "select user_name from users where user_id='". $row['user_id'] . "' limit 1";
  20. $r2 = mysqli_query($dbc, $q2);
  21. while($row2 = mysqli_fetch_array($r2))
  22. {
  23. echo $row2['user_name'];
  24. }
  25. echo '</td>';
  26. //score
  27. echo '<td>' . $row['score'] . '</td>';
  28. echo '</tr>';
  29. }
  30. echo '</tbody></table></div>';
  31. ?>