Advertisement
Guest User

Untitled

a guest
Jul 7th, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.13 KB | None | 0 0
  1. <?php
  2.  
  3. $host = "localhost";
  4. $user = "root";
  5. $pass = "";
  6. $characters = "characters"; //Karakter adatbázis neve.
  7. $con = mysql_connect($host,$user,$pass) or die (mysql_error());
  8. $border = 0;
  9. $hanyember = 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. //Printing the upper part of the table
  16. echo "<table border='" . $border . "'>";
  17. echo "<tr>";
  18. echo "<td>";
  19. echo "Név";
  20. echo "</td>";
  21. echo "<td>";
  22. echo "Class";
  23. echo "</td>";
  24. echo "<td>";
  25. echo "Race";
  26. echo "</td>";
  27. echo "<td>";
  28. echo "Honor";
  29. echo "</td>";
  30. echo "</tr>";
  31.  
  32. while($i < $numrows)
  33. {
  34. if($i+1 == $hanyember)
  35. break;
  36. $nev = mysql_result($query, $i, 0);
  37. $class = mysql_result($query, $i, 1);
  38. $race = mysql_result($query, $i, 2);
  39. $honor = mysql_result($query, $i, x);
  40.  
  41.  
  42. echo "<tr>";
  43. echo "<td>";
  44. echo $nev;
  45. echo "</td>";
  46. echo "<td>";
  47. echo $class;
  48. echo "</td>";
  49. echo "<td>";
  50. echo $race;
  51. echo "</td>";
  52. echo "<td>";
  53. echo $honor;
  54. echo "</td>";
  55. echo "</tr>";
  56.  
  57. $i += 1;
  58. }
  59. echo "</table>";
  60. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement