Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][MYSQL]Rekordy alfabetycznie
-Abees-
post
Post #1





Goście







Witam mam przykładowy skrypt wyświetlający liste banów z bazy danych:
  1. <?php
  2. function connect_db(){
  3. mysql_connect('server', 'username', 'password');
  4. mysql_select_db(database) or die( "Unable to select database");
  5. }
  6. connect_db();
  7.  
  8. $sql = 'SELECT * FROM `bans`'; // This is the query to be made
  9. $query = mysql_query($sql); // Here we execute the query
  10. ?>
  11. <h2>Banlist</h2>
  12. <br>
  13. <table border=1>
  14. <tr>
  15. <td><b>Name</b></td>
  16. <td><b>Release date</b></td>
  17. <td><b>Reason</b></td>
  18. </tr>
  19. <?php
  20. while ($player = mysql_fetch_array($query)) // Here we run thru the query's array
  21. {
  22. if ($player['type'] == 2) // We print only the Player Bans
  23. {
  24. echo '<tr>';
  25. echo '<td>'.$player['player'].'</td>'; // Players name...
  26. echo '<td>'.date('M d Y, H:i:s',$player['time']).'</td>'; // Release date...
  27. echo '<td>'.$player['reason'].'</td>'; // And reason!
  28. echo '</tr>'; // Done! :)
  29. }
  30. }
  31. ?>
  32. </table>

Chciałbym by po wciśnięciu np napisu Name wyświetliły się rekordy od A do Z a po 2 kliku od Z do A da się tak?
Jak tak to czy ktoś mógł w ten skrypt to w robić i powiedzieć jak to zrobił biggrin.gif
Dziękuje.
Go to the top of the page
+Quote Post

Posty w temacie
- Abees   [PHP][MYSQL]Rekordy alfabetycznie   24.05.2008, 17:03:41
- - piotrooo89   to problem z js bardziej niż z mysql'a. ...   24.05.2008, 17:23:12
- - Abees   No thx a wytłumaczysz bardziej skrypt itp?   24.05.2008, 17:27:31
- - Abees   ODŚWIEŻAM! Proszę o pomoc!   24.05.2008, 19:26:00
- - Abees   A może: SELECT * FROM nazwa_tabeli ORDER BY nazwa_...   25.05.2008, 08:57:18
- - Gośc   [PHP] pobierz, plaintext <?php if(...   25.05.2008, 09:01:58


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 Aktualny czas: 21.08.2025 - 16:09