Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Pager nie stronicuje
meron11
post
Post #1





Grupa: Zarejestrowani
Postów: 78
Pomógł: 1
Dołączył: 17.08.2009

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


mam taki kod :
  1. <? session_start() ;?>
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  3. <html>
  4. <head>
  5. <link rel="Stylesheet" type="text/css" href="style.css" />
  6.  
  7. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-2">
  8. <title>Mer press test</title>
  9. </head>
  10.  
  11. <body>
  12. <? include "mysql.php";
  13. require_once('Pager.class.php');
  14. connection();
  15. $query="select * FROM `artykuly` ORDER BY `id`";
  16. $out=mysql_query($query);
  17. //pager
  18. $sql = 'select count(*) from `artykuly`';
  19. $result = mysql_query($sql);
  20. $row = mysql_fetch_array($result);
  21. $recordsCount = $row[0];//pobranie liczby rekordów
  22. try{
  23. $pager = new Pager('idPagera');
  24. $pager->SetTotalRecords($recordsCount);
  25. $pager->Make(true);
  26. $pag = $pager->Render();
  27. $start = $pager->GetIndexRecordStart();
  28. $end = $pager->GetIndexRecordEnd();
  29. }
  30. catch (Exception $e) {
  31. echo $e->getMessage();
  32. }
  33.  
  34. ?>
  35.  
  36. <? while ($row = mysql_fetch_array($out, MYSQL_ASSOC)) {?>
  37.  
  38.  
  39. <div class="art" >
  40. <h1> <?echo $row['tytul'];?></h1>
  41. <br>
  42. <h3><? echo $row['data'] ?></h3>
  43. <br>
  44. <br><br>
  45. <?echo $row['artykul'];?>
  46. </div>
  47. <br><br><br>
  48.  
  49. <?}
  50. //zapytanie z uwzglenieniem stronicowania
  51. $sql = 'select * from `artykuly` limit '.$start.','.($end - $start + 1);
  52. //...pobranie wyników i ich wyswietlenie
  53.  
  54. echo $pag;//wyswietlenie pager'a?>
  55. </body>
  56. </html>


czemu niebangla ? tzn pager niestornicuje wszystko sie powtarza na każdej stronie

Ten post edytował meron11 24.06.2010, 20:47:05
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 Aktualny czas: 19.08.2025 - 10:15