Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL][PHP] Segregowanie
Sahee
post 19.03.2012, 11:21:50
Post #1





Grupa: Zarejestrowani
Postów: 34
Pomógł: 0
Dołączył: 1.09.2011

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


Witam, robie ranking. Rankind ma być na zasadzie kill death stat czyli statystyk zabójstwa przez zgony. Chciałbym aby to sie wyświetlalo w kolejności od najwiekszej do najmniejszej.
Zarazie mam coś takiego:
  1. <?php
  2. require_once('inc/system.php');
  3. $h1 = "Ranking";
  4. if(empty($oUser)) header('location: index.php');
  5. //Queries id, name, leader, tag, friendly_fire, neutral_kills, rival_kills, civilian_kills, deaths, last_seen, join_date, trusted, flags from sc_players where 'name' = '".$nickszuk."'"
  6. $sql = mysql_query('SELECT id, name, leader, tag, friendly_fire, rival_kills, neutral_kills, civilian_kills, deaths, last_seen, join_date, trusted FROM sc_players ORDER BY civilian_kills DESC LIMIT 50');
  7. //Create table
  8.  
  9. $gra ="<center>
  10. <table border='0' cellpadding='2' cellspacing='5' align='center'>
  11. <tr align='center'>
  12. <td width='30'>Nick</td>
  13. <td width='30'>Zabójstra Przyjaciól</td>
  14. <td width='30'>Neutralne Zabójstra</td>
  15. <td width='30'>Zabójstwa wrogów</td>
  16. <td width='30'>Zabójstwa ludzi bez klanów</td>
  17. <td width='30'>Zgony</td>
  18. <td width='30'>Punktu</td>
  19.  
  20. </tr>";
  21. //Fetch mysql data
  22. while($data = mysql_fetch_assoc($sql)) {
  23. $wynik = 100 * ($data['friendly_fire'] * 0.5 + $data['neutral_kills'] * 1 + $data['rival_kills'] * 1.5 + $data['civilian_kills'] * 1) / 10 + $data['deaths'] ;
  24. $gra .= '<tr align="center">
  25. <td>' . $data['name'] . '</td>
  26. <td>' . $data['friendly_fire'] . '</td>
  27. <td>' . $data['neutral_kills'] . '</td>
  28. <td>' . $data['rival_kills'] . '</td>
  29. <td>' . $data['civilian_kills']. '</td>
  30. <td>' . $data['deaths'] . '</td>
  31. <td>' .$wynik.'</td>
  32. </tr>';
  33. }
  34.  
  35. $gra .= "</table></center>";
  36.  
  37. require_once('inc/szablon.php');
  38. ?>
  39.  


chcialbym aby php układal mi to w kolejności od najwiekszego $wynik do najmniejszej. Jak to teraz przerobić ;d

Ten post edytował Sahee 19.03.2012, 11:27:27
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Wersja Lo-Fi Aktualny czas: 25.07.2025 - 10:42