Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php][Mysql] Podział rekordów na strony
Dawior
post
Post #1





Grupa: Zarejestrowani
Postów: 81
Pomógł: 0
Dołączył: 15.03.2008

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


Witam jak zrobić podział rekordów na strony?. Bardzo proszę o odpowiedź z góry dzięki.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Dawior
post
Post #2





Grupa: Zarejestrowani
Postów: 81
Pomógł: 0
Dołączył: 15.03.2008

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


Teraz mam takie coś:
  1. <?
  2. include 'conn.php';
  3. $start = $_GET['strona'];
  4. $na_stronie = 10;
  5.  
  6. $wykonaj=mysql_query("SELECT * FROM news");
  7. $znaleziono=mysql_num_rows($wykonaj);
  8. if($znaleziono>$na_stronie) {
  9.    print '<center>Strona ';
  10. for($i=0; $i<ceil($znaleziono/$na_stronie); $i++)
  11.  print '<a href="index.php?strona='.($i*$na_stronie).'">'.($i+1).'</a> | ';
  12. }  
  13. print '</center>';
  14.  
  15. $query = "SELECT * FROM news LIMIT ".($start).",".$na_stronie."";
  16. $result = mysql_query ($query);
  17.        while ($row = mysql_fetch_array($result))
  18.        {
  19. echo '<table border="0" width="500" cellpadding="0" cellspacing="0" align="center">
  20. <tr><td class="news"><center><b>'.$row['tytul'].'</b></center></td></tr>
  21. <tr><td class="newstlo">';
  22. echo ''.$row['opis'].'<br>';
  23. echo '<div class="nesdol">
  24. </div>
  25. </td></tr>
  26. <td class="newsdol"><a href="/'.$row['id'].'-'.namen($row['tytul']).'.html">Zobacz więcej...</a></td>
  27. </table><br><br>';
  28. }
  29.  
  30. ?>


ale się wyświetla taki błąd: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\Program Files\WebServ\httpd\engine\podzial.php on line 17
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: 7.10.2025 - 02:05