Advertisement
Guest User

Untitled

a guest
Jul 7th, 2017
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.06 KB | None | 0 0
  1. <?php
  2.  
  3. $host = "localhost";
  4. $user = "root";
  5. $pass = "";
  6. $characters = "characters";
  7. $con = mysql_connect($host,$user,$pass) or die (mysql_error());
  8. $border = 0;
  9. $letszam = 10;
  10.  
  11. $query = mysql_query("SELECT `name`, `class`, `race`, `totalHonorPoints` FROM `".$characters."`.`characters` ORDER BY `totalHonorPoints`") or die (mysql_error());
  12. $numrows = mysql_num_rows($query);
  13. $i = 0;
  14.  
  15. echo "<table border='" . $border . "'>";
  16. echo "<tr>";
  17. echo "<td>";
  18. echo "Név";
  19. echo "</td>";
  20. echo "<td>";
  21. echo "Class";
  22. echo "</td>";
  23. echo "<td>";
  24. echo "Race";
  25. echo "</td>";
  26. echo "<td>";
  27. echo "Honor";
  28. echo "</td>";
  29. echo "</tr>";
  30.  
  31. while($i < $numrows)
  32. {
  33. if($i+1 == $letszam)
  34. break;
  35. $nev = mysql_result($query, $i, 0);
  36. $class = mysql_result($query, $i, 1);
  37. $race = mysql_result($query, $i, 2);
  38. $honor = mysql_result($query, $i, 3);
  39.  
  40.  
  41. echo "<tr>";
  42. echo "<td>";
  43. echo $nev;
  44. echo "</td>";
  45. echo "<td>";
  46. echo $class;
  47. echo "</td>";
  48. echo "<td>";
  49. echo $race;
  50. echo "</td>";
  51. echo "<td>";
  52. echo $honor;
  53. echo "</td>";
  54. echo "</tr>";
  55.  
  56. $i += 1;
  57. }
  58. echo "</table>";
  59. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement