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
 
Start new topic
Odpowiedzi
meron11
post
Post #2





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

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


nadal nieczaje .... poprawiłęm na tak :
  1. <? include "mysql.php";
  2. require_once('Pager.class.php');
  3. connection();
  4. $query="select * FROM `artykuly` ORDER BY `id`";
  5. $result=mysql_query($query);
  6. //pager
  7. $wy = mysql_fetch_array($result);
  8. $recordsCount = $wy[0];//pobranie liczby rekordów
  9. try{
  10. $pager = new Pager('idPagera');
  11. $pager->SetTotalRecords($recordsCount);
  12. $pager->Make(true);
  13. $pag = $pager->Render();
  14. $start = $pager->GetIndexRecordStart();
  15. $end = $pager->GetIndexRecordEnd();
  16. }
  17. catch (Exception $e) {
  18. echo $e->getMessage();
  19. }
  20.  
  21. ?>
  22.  
  23. <? while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {?>
  24.  
  25.  
  26. <div class="art" >
  27. <h1> <?echo $row['tytul'];?></h1>
  28. <br>
  29. <h3><? echo $row['data'] ?></h3>
  30. <br>
  31. <br><br>
  32. <?echo $row['artykul'];?>
  33. </div>
  34. <br><br><br>
  35.  
  36. <?}
  37. //zapytanie z uwzglenieniem stronicowania
  38. $query = 'select * from `artykuly` limit '.$start.','.($end - $start + 1);
  39. //...pobranie wyników i ich wyswietlenie
  40.  
  41. echo $pag;//wyswietlenie pager'a?>
to pager wgl się niepojawia ;/
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: 11.10.2025 - 03:11