Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php, sql] Sortowanie alfabetyczne
mate
post
Post #1





Grupa: Zarejestrowani
Postów: 50
Pomógł: 0
Dołączył: 27.06.2007

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


Witam!
Mam skrypt:
  1. <?php
  2.  
  3.  if ($letter) {
  4.  
  5. $sql = "select tipid, title, date, rating from tips where title like '$letter%' and status = 'L' ";
  6.  
  7.  } else {
  8.  
  9. $sql = "select tipid, title, date, rating from tips where catid = $catid and status
     = 'L' "
    ;
  10.  
  11.  }
  12.  
  13.  $result = mysql_query($sql ,$db);
  14.  $numrows = mysql_numrows($result);
  15.  
  16.  $lastpage = false;
  17.  
  18.  if ($pagenum == 0) {
  19. $startrow = 0;
  20.  } else {
  21. $startrow = 25 * $pagenum;
  22.  }
  23.  
  24.  if ($numrows < $startrow + 25) {
  25. $endrow = $numrows;
  26. $lastpage = true;
  27.  }
  28.  
  29.  if ($letter) {
  30.  
  31. $sql = "select tipid, title, date, rating from tips where title like '$letter%' and status = 'L' limit $startrow,25";
  32. $pagetitle = "Tips starting in the letter '$letter'";
  33.  
  34.  } else {
  35.  
  36. $sql = "select * from categories where catid = $catid";
  37. $result = mysql_query($sql ,$db);
  38. $row = mysql_fetch_row($result);
  39. $pagetitle = $row[1];
  40.  
  41. $sql = "select tipid, title, date, rating from tips where catid = $catid and status
     = 'L' limit $startrow,25"
    ;
  42.  
  43.  }
  44.  
  45. ?>

i mam pytanie jak to przerobic zeby bylo sortowanie alfabetyczne?
Pozdro
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: 25.08.2025 - 12:35