Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [MySQL][PHP]stronicowanie szukam jakiegoś działającego !
GryFF
post
Post #1





Grupa: Zarejestrowani
Postów: 93
Pomógł: 0
Dołączył: 3.10.2011

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


W necie jest tego pełno ale żadne nie działało mi poprawnie tzn strony się mieszały i td więc mam do was prośbę o danie jakiegoś sprawdzonego stronicowania którego sami używacie, za każdą odp daje +
Go to the top of the page
+Quote Post
tolomei
post
Post #2





Grupa: Zarejestrowani
Postów: 450
Pomógł: 135
Dołączył: 18.11.2010
Skąd: Wschowa

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


Skrypt naszego kolegi nospora: Temat: Pager stronicowanie
Go to the top of the page
+Quote Post
GryFF
post
Post #3





Grupa: Zarejestrowani
Postów: 93
Pomógł: 0
Dołączył: 3.10.2011

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


Dzięki i oczywiście + ;-)

Oj nie bo to ma być pobierane z tabeli MYSQL ( id )
Go to the top of the page
+Quote Post
Ruch Radzionków
post
Post #4





Grupa: Zarejestrowani
Postów: 311
Pomógł: 25
Dołączył: 29.08.2011

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


  1. define('MAXPAGE', 25);
  2. $pok = mysql_query("SELECT COUNT(*) FROM users ORDER BY id");
  3. list($max) = mysql_fetch_row($pok);
  4. $total = ceil($max / MAXPAGE);
  5. $page = intval(@$_GET["page"]);
  6. if(0 == $page)
  7. {
  8. $page = 1;
  9. }
  10. $start = MAXPAGE * ($page - 1);
  11. $full = MAXPAGE;
  12. $obej = mysql_query("SELECT * FROM users ORDER BY id limit $start, $full");
  13. while(list($id, $login, $haslo, $mail, $status, $langs, $data, $admin, $oficjalne) = mysql_fetch_row($obej))
  14. {
  15. //dany text
  16. }
  17. if($_GET[page] == '')
  18. {
  19. $strona = '1';
  20. }
  21. else
  22. {
  23. $strona = $_GET[page];
  24. }
  25. $poprzedniastrona = $_GET[page] - 1;
  26. if($_GET[page] == '')
  27. {
  28. $nastepnastrona = '2';
  29. }
  30. else
  31. {
  32. $nastepnastrona = $_GET[page] + 1;
  33. }
  34. echo'</table>';
  35. if($total == '0')
  36. {
  37.  
  38. }
  39. else
  40. {
  41. echo'<table align="center">
  42. <tr>
  43. <td>';
  44. if(($_GET[page] == '1') || ($_GET[page] == ''))
  45. {
  46. }
  47. else
  48. {
  49. echo'<a href="index.php?event=users&page=1"><input type="submit" value="'.$lang[pierwszastronakatalog].'"></a><a href="index.php?event=users&page='.$poprzedniastrona.'"><input type="submit" value="'.$lang[poprzedniastronakatalog].'"></a>';
  50. }
  51. echo $lang[stronakatalog]; echo $strona; echo $lang[zkatalog]; echo $total;
  52. if($strona == $total)
  53. {
  54.  
  55. }
  56. else
  57. {
  58. echo'<a href="index.php?event=users&page='.$nastepnastrona.'"><input type="submit" value="'.$lang[nastepnastronakatalog].'"></a><a href="index.php?event=users&page='.$total.'"><input type="submit" value="'.$lang[ostatniastronakatalog].'"></a>';
  59. }
  60. echo'</td>
  61. </tr>
  62. </table>';
  63. }
Go to the top of the page
+Quote Post
tolomei
post
Post #5





Grupa: Zarejestrowani
Postów: 450
Pomógł: 135
Dołączył: 18.11.2010
Skąd: Wschowa

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


Ten skrypt jest zgodny z Twoimi oczekiwaniami(skrypt nospora).

Ten post edytował tolomei 15.04.2012, 21:25:55
Go to the top of the page
+Quote Post
GryFF
post
Post #6





Grupa: Zarejestrowani
Postów: 93
Pomógł: 0
Dołączył: 3.10.2011

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


@Ruch.., nie działa :/ proszę zobaczyć ospnadolany.cba.pl

ustawienia takie

  1. define('MAXPAGE', 1);
Go to the top of the page
+Quote Post
Ruch Radzionków
post
Post #7





Grupa: Zarejestrowani
Postów: 311
Pomógł: 25
Dołączył: 29.08.2011

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


gryff na pewno dzialo jo z niego korzystom caly cos
a to:
define('MAXPAGE', 1);
jest ile sie mo na stronie znalesc
Go to the top of the page
+Quote Post
GryFF
post
Post #8





Grupa: Zarejestrowani
Postów: 93
Pomógł: 0
Dołączył: 3.10.2011

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


no to właśnie mam ustawione na 1 i powinnien być jeden news a jest sobie popatrz (IMG:style_emoticons/default/sad.gif) www.ospnadolany.cba.pl
Go to the top of the page
+Quote Post
Ruch Radzionków
post
Post #9





Grupa: Zarejestrowani
Postów: 311
Pomógł: 25
Dołączył: 29.08.2011

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


to pokaz caly kod
Go to the top of the page
+Quote Post
GryFF
post
Post #10





Grupa: Zarejestrowani
Postów: 93
Pomógł: 0
Dołączył: 3.10.2011

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


  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <!--
  3. Design by Free CSS Templates
  4. <a href="http://www.freecsstemplates.org" target="_blank">http://www.freecsstemplates.org</a>
  5. Released for free under a Creative Commons Attribution 2.5 License
  6.  
  7. Name : Simple Passage
  8. Description: A three-column, fixed-width blog design.
  9. Version : 1.0
  10. Released : 20090327
  11.  
  12. -->
  13.  
  14. <link rel="icon" type="image/png" href="favicon.ico">
  15. <html xmlns="http://www.w3.org/1999/xhtml">
  16. <head>
  17. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  18. <title>OSP Nadolany</title>
  19. <meta name="keywords" content="" />
  20. <meta name="Simple Passage" content="" />
  21. <link href="default.css" rel="stylesheet" type="text/css" media="screen" />
  22. </head>
  23. <body>
  24.  
  25. <!-- start header -->
  26. <div id="header">
  27. <div id="logo">
  28. <h1><span> <div class="header1"><div align="right"><br />
  29. </div></a></h1>
  30. </div>
  31. <div id="menu">
  32. <ul id="main">
  33. <!-- MENU START -->
  34. <?PHP
  35. include('include/menu.txt');
  36. ?>
  37. <!-- MENU KONIEC -->
  38.  
  39. </ul>
  40. </div>
  41. </div>
  42. <div id="wrapper">
  43. <div id="page">
  44. <div id="page-bgtop">
  45. <div id="page-bgbtm">
  46. <div id="sidebar1" class="sidebar">
  47. <ul>
  48. <li>
  49. <h2>Menu</h2>
  50. <ul>
  51. <!-- MENU LEWE START -->
  52. <?PHP
  53. include('include/menulewe.txt');
  54. ?>
  55. <!-- MENU LEWE KONIEC -->
  56. </ul>
  57. </li>
  58. <!-- POGODA START -->
  59. <?PHP
  60. include('include/pogoda.txt');
  61. ?>
  62.  
  63. <!-- POGODA KONIEC -->
  64. <div id="content">
  65.  
  66.  
  67.  
  68.  
  69.  
  70. <?PHP
  71. include('news.php');
  72. ?>
  73.  
  74. <?
  75. define('MAXPAGE', 1);
  76. $pok = mysql_query("SELECT COUNT(*) FROM newsy ORDER BY id");
  77. list($max) = mysql_fetch_row($pok);
  78. $total = ceil($max / MAXPAGE);
  79. $page = intval(@$_GET["page"]);
  80. if(0 == $page)
  81. {
  82. $page = 1;
  83. }
  84. $start = MAXPAGE * ($page - 1);
  85. $full = MAXPAGE;
  86. $obej = mysql_query("SELECT * FROM newsy ORDER BY id limit $start, $full");
  87. while(list($id) = mysql_fetch_row($obej))
  88. {
  89. //dany text
  90. }
  91. if($_GET[page] == '')
  92. {
  93. $strona = '1';
  94. }
  95. else
  96. {
  97. $strona = $_GET[page];
  98. }
  99. $poprzedniastrona = $_GET[page] - 1;
  100. if($_GET[page] == '')
  101. {
  102. $nastepnastrona = '2';
  103. }
  104. else
  105. {
  106. $nastepnastrona = $_GET[page] + 1;
  107. }
  108. echo'</table>';
  109. if($total == '0')
  110. {
  111.  
  112. }
  113. else
  114. {
  115. echo'<table align="center">
  116. <tr>
  117. <td>';
  118. if(($_GET[page] == '1') || ($_GET[page] == ''))
  119. {
  120. }
  121. else
  122. {
  123. echo'<a href="index.php?event=users&page=1"><input type="submit" value="'.$lang[pierwszastronakatalog].'"></a><a href="index.php?event=users&page='.$poprzedniastrona.'"><input type="submit" value="'.$lang[poprzedniastronakatalog].'"></a>';
  124. }
  125. echo $lang[stronakatalog]; echo $strona; echo $lang[zkatalog]; echo $total;
  126. if($strona == $total)
  127. {
  128.  
  129. }
  130. else
  131. {
  132. echo'<a href="index.php?event=users&page='.$nastepnastrona.'"><input type="submit" value="'.$lang[nastepnastronakatalog].'"></a><a href="index.php?event=users&page='.$total.'"><input type="submit" value="'.$lang[ostatniastronakatalog].'"></a>';
  133. }
  134. echo'</td>
  135. </tr>
  136. </table>';
  137. }
  138. ?>
  139.  
  140.  
  141.  
  142. </div>
  143. <div id="sidebar2" class="sidebar">
  144. <ul>
  145. <li>
  146. <form id="searchform" method="get" action="#">
  147. <div>
  148. <!-- MENU PRAWE START -->
  149.  
  150. <?PHP
  151. include('include/menuprawe.txt');
  152. ?>
  153. <!-- MENU PRAWE KONIEC -->
  154. </ul>
  155. </div>
  156. <div style="clear: both;">&nbsp;</div>
  157. </div>
  158. </div>
  159. </div>
  160. </div>
  161. <!-- STOPKA START -->
  162. <div id="footer">
  163. <?PHP
  164. include('include/stopka.txt');
  165. ?>
  166. <!-- STOPKA KONIEC -->
  167. </div>
  168. </body>
  169. </html>
Go to the top of the page
+Quote Post
Ruch Radzionków
post
Post #11





Grupa: Zarejestrowani
Postów: 311
Pomógł: 25
Dołączył: 29.08.2011

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


  1. while(list($id) = mysql_fetch_row($obej))
  2. {
  3. //dany text
  4. }


tak gdzie pisze //dany text
dodajesz news czyli tak jak ty masz cos takiego na stronie

Kod
Muza Hudego :D
! HIT ! ! HIT ! ! HIT ! ! HIT ! ! HIT ! ! HIT !
Piosenka dedykowana dla Nadolan Od Hudego!
Link do piosenki
http://trololololololololololo.com/
Teledysk piosenki!! HIT (IMG:style_emoticons/default/exclamation.gif) !!!!
http://www.youtube.com/watch?v=KaqC5FnvAEc
Miłego słuchania! Pozdrawiam DooOminO;-)+


dodano : 2012-04-15 21:14:24
autor : DooOminO


Go to the top of the page
+Quote Post
GryFF
post
Post #12





Grupa: Zarejestrowani
Postów: 93
Pomógł: 0
Dołączył: 3.10.2011

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


Jak mam dać tekst jeżeli ja mam system newsów połączony z sql?

Ten post edytował GryFF 16.04.2012, 14:15:49
Go to the top of the page
+Quote Post
Ruch Radzionków
post
Post #13





Grupa: Zarejestrowani
Postów: 311
Pomógł: 25
Dołączył: 29.08.2011

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


jak masz w bazie np.

id||tytul||tresc||data

no to na stronie robisz cos takiego:

  1. while(list($id, $tytul, $tresc, $data) = mysql_fetch_row($obej))
  2. {
  3. echo'tytuł: '.$tytul.'<br>'.$tresc.'<br>'.$data.'';
  4. }
Go to the top of the page
+Quote Post
GryFF
post
Post #14





Grupa: Zarejestrowani
Postów: 93
Pomógł: 0
Dołączył: 3.10.2011

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


jak mam to dać jak wszystko mam w ionclude wygląd cały.. ? a tu same dane z sql?..


system newsów nie mogę tam wywołać bo mam błąd


to część newsów do której ioncude ma wywoałenie

  1. <?
  2. #Informacje o bazie danych includowane z pliku news_cfg.php
  3. include("news_cfg.php");
  4.  
  5. #łączenie się z bazą danych. Wymagane do odczytania Newsów z bazy
  6. $connect = mysql_connect($host, $user, $haslo) or die('<h2>Błąd podczasz łączenia się z bazą danych');
  7. $wybieranie = mysql_select_db($base, $connect) or die("<h2>Błąd Wybierania bazy danych, Prawdopodobnie taka Baza nie istnieje");
  8. $stworz = mysql_query('CREATE TABLE IF NOT EXISTS `newsy` (
  9. `id` int(11) NOT NULL AUTO_INCREMENT,
  10. `tytul` text NOT NULL,
  11. `opis` text NOT NULL,
  12. `autor` text NOT NULL,
  13. `data` text NOT NULL,
  14. `tresc` text NOT NULL,
  15. PRIMARY KEY (id)
  16. )
  17. ') or die('Nie mogę stworzyć tabeli w bazie danych ! ');
  18.  
  19. #Pobieranie Newsów z bazy danych
  20. $pobierz = mysql_query("SELECT * from `newsy` ORDER BY `id` DESC LIMIT 0, $ile");
  21.  
  22. #pętla
  23. while($news = mysql_fetch_array($pobierz))
  24. {
  25. include("wyglad.php");
  26. }
  27.  
  28. ?>


Ten post edytował GryFF 16.04.2012, 14:32:58
Go to the top of the page
+Quote Post
Ruch Radzionków
post
Post #15





Grupa: Zarejestrowani
Postów: 311
Pomógł: 25
Dołączył: 29.08.2011

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


pokoz mi plik news.php
Go to the top of the page
+Quote Post
GryFF
post
Post #16





Grupa: Zarejestrowani
Postów: 93
Pomógł: 0
Dołączył: 3.10.2011

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


news.php jest post wyżej twojego raczej chodziło ci pewnie o wyglad.php (IMG:style_emoticons/default/biggrin.gif)


  1. <?
  2.  
  3. #Dane
  4.  
  5. # {$news['autor']} = Autor Newsa
  6. # {$news['data']} = Data Dodania Newsa
  7. # {$news['opis']} = Opis Newsa
  8. # {$news['tytul']} = tytul newsa
  9. # {$news['tresc']} = Tresc Newsa
  10. # {$news['id']} = ID newsa
  11.  
  12. #Koniec danych
  13.  
  14.  
  15. #w znacznikach echo <<< wyglad umieszczacie czysty KOD HTML, z użyciem {$news['cos']} gdzie cos to AUTOR/DATA/OPIS/TYTUL/TRESC/ID
  16.  
  17.  
  18. echo <<< wyglad
  19. <div class="flower"></div>
  20. <div class="post"><div align="center">
  21. <h1 class="title">{$news['tytul']}</a></h1>
  22. <div class="entry">
  23.   <p> {$news['tresc']} </p>
  24.   <p> <strong><div align="right"><font size="1">dodano : {$news['data']} <br /> autor : {$news['autor']} </strong></font></div><p>
  25. <p class="links"><a href="#" class="more"></a></p></div>
  26.  
  27. </div>
  28. </div>
  29.  
  30. wyglad;
  31. ?>


@ruch rodzianków, dziękuję za pomoc (IMG:style_emoticons/default/smile.gif) wszystko działa dla ciebie +++++++
Go to the top of the page
+Quote Post

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: 27.09.2025 - 18:08