Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]dodatkowy ranking
richat
post
Post #1





Grupa: Zarejestrowani
Postów: 4
Pomógł: 0
Dołączył: 26.04.2011

Ostrzeżenie: (0%)
-----


witam wszystkich,mam kłopocik ze zrobieniem dodatkowego rankingu tzn.żeby była opcja pokazania graczy nie tylko ogólnego rankingu ale zarejestrowanych np. po 24.04.2011 (tak zwany nowy sezon gry)
szukam kombinuje ale coś mi nie wychodzi,
poniżej plik ranking.php



  1. <?php
  2. if(!isSet($_SESSION['street-race'])){
  3. header("Location: index.php");
  4. }
  5. $user = $_SESSION['street-race'];
  6. include "baza.php";
  7. $title = 'Ranking graczy';
  8. include "gora.php";
  9. echo "<a href='ranking.php'>Kierowcy</a> | <a href='ranking.php?teamy'>Teamy</a><br /><br />";
  10. if(isSet($_GET['teamy'])){
  11. echo "<table width='100%'>
  12. <tr>
  13. <td class='r1'> </td>
  14. <td class='r1'>Nazwa</td>
  15. <td class='r1'>Tag</td>
  16. <td class='r1'>Respekt</td>
  17. <td class='r1'>Lv</td>
  18. <td class='r1'>Wygrali</td>
  19. <td class='r1'>Przegrali</td>
  20. <td class='r1'>Założyciel</td>
  21. </tr>";
  22. $zapytanie = mysql_query("SELECT * FROM team ORDER by respekt DESC");
  23. $i = 1;
  24. while($tab = mysql_fetch_assoc($zapytanie)){
  25. echo "<tr>
  26. <td>" . $i++ . "</td>
  27. <td><a href='team.php?team=" . str_replace('&', '6354623727', $tab['tag']) . "'>" . $tab['nazwa'] . "</a></td>
  28. <td>" . $tab['tag'] . "</td>
  29. <td>" . $tab['respekt'] . "</td>
  30. <td>" . $tab['lvl'] . "</td>
  31. <td>" . $tab['wygral'] . "</td>
  32. <td>" . $tab['przegral'] . "</td>
  33. <td><a href='profil.php?user=" . $tab['zalozyciel'] . "'>" . $tab['zalozyciel'] . "</a></td>
  34. </tr>";
  35. }
  36. echo "</table>";
  37. }
  38. else{
  39. $jest = mysql_fetch_row(mysql_query("SELECT COUNT(*) FROM user"));
  40. $strona = ceil($jest[0] / 1000);
  41. echo "<a href='ranking.php'>1</a> ";
  42. for($i=1; $i<$strona; $i++){
  43. $e = $i."001";
  44. echo "| <a href='ranking.php?page=".$e."'>". ((int)$i+1) . "</a> ";
  45. }
  46. if(isSet($_GET['page'])){
  47. $q = (int)$_GET['page'] - 1;
  48. $zapytanie = mysql_query("SELECT user, lvl, respekt, doswiadczenie, wygral, przegral, ranking, tag FROM user ORDER by ranking ASC LIMIT ".$q.",1000");
  49. }
  50. else{
  51. $zapytanie = mysql_query("SELECT user, lvl, respekt, doswiadczenie, wygral, przegral, ranking, tag FROM user ORDER by ranking ASC LIMIT 0,1000");
  52. }
  53. echo "<table width='100%'>
  54. <tr>
  55. <td class='r1'> </td>
  56. <td class='r1'>Kierowca</td>
  57. <td class='r1'>Respekt</td>
  58. <td class='r1'>Doświadczenie</td>
  59. <td class='r1'>Lv</td>
  60. <td class='r1'>Wygrał</td>
  61. <td class='r1'>Przegrał</td>
  62. <td class='r1'>Tag</td>
  63. </tr>";
  64. while($tab = mysql_fetch_assoc($zapytanie)){
  65. if($tab['user'] == $user){
  66. echo "<tr><td class='r2'>" . $tab['ranking'] . "</td>
  67. <td class='r2'><a href='profil.php?user=" . $tab['user'] . "'>" . $tab['user'] . "</a></td>
  68. <td class='r2'>" . round($tab['respekt'], '0') . "</td>
  69. <td class='r2'>" . round($tab['doswiadczenie'], '0') . "</td>
  70. <td class='r2'>" . $tab['lvl'] . "</td>
  71. <td class='r2'>" . $tab['wygral'] . "</td>
  72. <td class='r2'>" . $tab['przegral'] . "</td>
  73. <td class='r2'><a href='team.php?team=" . str_replace('&', '6354623727', $tab['tag']) . "'>" . $tab['tag'] . "</a></td>
  74. </tr>";
  75. }
  76. else{
  77. echo "<tr><td>" . $tab['ranking'] . "</td>
  78. <td><a href='profil.php?user=" . $tab['user'] . "'>" . $tab['user'] . "</a></td>
  79. <td>" . round($tab['respekt'], '0') . "</td>
  80. <td>" . round($tab['doswiadczenie'], '0') . "</td>
  81. <td>" . $tab['lvl'] . "</td>
  82. <td>" . $tab['wygral'] . "</td>
  83. <td>" . $tab['przegral'] . "</td>
  84. <td><a href='team.php?team=" . str_replace('&', '6354623727', $tab['tag']) . "'>" . $tab['tag'] . "</a></td>
  85. </tr>";
  86. }
  87. }
  88. echo "</table>";
  89. }
  90. include "dol.php";
  91. ?>


Ten post edytował richat 26.04.2011, 19:11:37
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
richat
post
Post #2





Grupa: Zarejestrowani
Postów: 4
Pomógł: 0
Dołączył: 26.04.2011

Ostrzeżenie: (0%)
-----


kurde gryzie,myślałem z tym kawałkiem kodu coś zrobić
$zapytanie = mysql_query("SELECT user, lvl, respekt, doswiadczenie, wygral, przegral, ranking, tag FROM user ORDER by ranking ASC LIMIT ".$q.",1000");
coś trzeba dodać ale jestem zielony
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 4.10.2025 - 21:28