Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php]przekazanie wartosci
droicyn
post 17.04.2006, 23:39:50
Post #1





Grupa: Zarejestrowani
Postów: 6
Pomógł: 0
Dołączył: 12.04.2006

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


  1. <?php
  2.  
  3.  
  4. // Dane z SQL'a do tablicy
  5. $count = 0;
  6. while($record_smiles = mysql_fetch_array($result_smiles))
  7. {
  8. $array_smiles[$count]['smile'] = $record_smiles['smile'];
  9. $array_smiles[$count]['file'] = $record_smiles['file'];
  10.  
  11. $count++;
  12. }
  13. if (isset($_POST['send']))
  14. {
  15. $int_poile = $_POST['submit_poile'];
  16. if(!isset($_GET['od']))
  17. {
  18. $int_od = 0;
  19.  
  20. }
  21. else
  22. {
  23. $int_od = $_GET['od'];
  24. }
  25. }
  26. else
  27. {
  28. $int_poile = 5;
  29. if(!isset($_GET['od']))
  30. {
  31. $int_od = 0;
  32.  
  33. }
  34. else
  35. {
  36. $int_od = $_GET['od'];
  37. }
  38. }
  39.  
  40. $sql = "SELECT id, status, text_short, title, nick, image, link, date, mail FROM ne
    ws_news WHERE status='1' ORDER BY date DESC"
    ; 
  41. $result_num = mysql_query($sql);
  42. $newsy = 0;
  43. $newsy = mysql_num_rows($result_num);
  44.  
  45.  
  46. $limit = ' LIMIT ' . $int_od . ', ' . $int_poile;
  47.  
  48. $sql = "SELECT id, status, text_short, title, nick, image, link, date, mail FROM ne
    ws_news WHERE status='1' ORDER BY date DESC $limit"
    ; 
  49. $result = mysql_query($sql);
  50.  
  51.  
  52. while($record = mysql_fetch_array($result))
  53. {
  54. if ($record['status'] == 1)
  55. {
  56. $id_news = $record['id'];
  57. $num_comments = 0;
  58.  
  59. $sql = "SELECT id, id_news FROM news_comments WHERE id_news='$id_news'";
  60. $result_comments = mysql_query($sql);
  61. $num_comments = mysql_num_rows($result_comments);
  62.  
  63. for ($i = 0; $i < count($array_smiles); $i++)
  64. {
  65. $record['text_short'] = str_replace($array_smiles[$i]['smile'], '<img src="images/smiles/icon_' . $array_smiles[$i]['file'] . '.gif" />', $record['text_short']);
  66. }
  67.  
  68. if(!empty($record['image']))
  69. {
  70. $image = '<img src="images/avatars/' . $record['image'] . '">';
  71. }
  72. else
  73. {
  74. $image = '';
  75. }
  76.  
  77. $link_short = $record['link'];
  78.  
  79. if(strlen($link_short) > 20)
  80. {
  81. $link_short = substr($link_short, 0,20);
  82. $link_short .= '...';
  83. }
  84.  
  85. if (!empty($record['link']))
  86. {
  87. $link = '<br /><br /><b>Link:</b> <a href="' . $record['link'] . '" target="_blank">' . $link_short . '</a>';
  88. }
  89. else
  90. {
  91. $link = '';
  92. }
  93.  
  94. //wyswietlam link nick ttytul acatar i mail
  95. }
  96.  
  97. }
  98.  
  99. <table class="news_short" cellpadding="0" cellspacing="0" width="300">
  100. <form action="index.php?po='. $int_poile .'" method="post">
  101. <tr>
  102. <td class="nick" width="70" align="center">Pokaż po</td>
  103. <td class="nick" width="60" align="center"><select name="submit_poile"><option>1<option selected>5<option>10<option>25</td>
  104. <td class="nick" width="110" align="center"> newsów na stronie</td>
  105. <td class="nick" width="60" align="center"><input type="submit" name="send" value="Pokaż" /></td>
  106. </tr>
  107. </form>
  108. </table>
  109. <br /><br />';
  110. $prev = $int_od - $int_poile;
  111. if($prev >=0)
  112. {
  113. if(isset($_POST['submit_poile']))
  114. {
  115. echo '<a href="index.php?po=' . $int_poile .'&od=' . $prev . '"><span class="arrows">&laquo; Poprzednia&nbsp;&nbsp;</span></a>';
  116. }
  117. else
  118. {
  119. echo '<a href="index.php?od=' . $prev . '"><span class="arrows">&laquo; Poprzednia&nbsp;&nbsp;</span></a>';
  120. }
  121. }
  122. else
  123. {
  124. echo '<span class="arrows2">&laquo; Poprzednia&nbsp;&nbsp;</span>';
  125.  
  126. }
  127. $x = 0;
  128. for($j = 0; $j<$newsy; $j+=$int_poile)
  129. {
  130. if ($j != 0)
  131. {
  132. echo '<span class="arrows">&nbsp;|&nbsp;</span>';
  133. }
  134. if($j == $_GET['od'])
  135. {
  136. echo '<b>'.($x + 1).'</b>';
  137. }
  138. else
  139. {
  140. if(isset($_POST['submit_poile']))
  141. {
  142. echo '<a href="index.php?po=' . $int_poile . '&od='. $j .'">' .($x + 1). '</a>';
  143. }
  144. else
  145. {
  146. echo '<a href="index.php?od=' . $j . '">' .($x + 1). '</a>';
  147. }
  148. }
  149. $x++;
  150. }
  151. $next = $int_od + $int_poile;
  152. if($next<floor($newsy))
  153. {
  154. if(isset($_POST['submit_poile']))
  155. {
  156. echo '<a href="index.php?po=' . $int_poile .'&od='. $next . '"><span class="arrows">&laquo; Poprzednia&nbsp;&nbsp;</span></a>';
  157. }
  158. else
  159. {
  160. echo '<a href="index.php?od=' .$next . '"><span class="arrows">&nbsp;&nbsp;Następna&nbsp;&raquo;</span></a>';
  161. }
  162. }
  163. else
  164. {
  165. echo '<span class="arrows2">&nbsp;&nbsp;Następna&nbsp;&raquo;</span>';
  166.  
  167. }
  168.  
  169.  
  170. ?>

i chodzi o to ze chce przekazac wartosci z linii 107 so linii 47 zeby moc sortowac newsy tak jak to sobie wybieram! w jaki sposob moge to zrobic?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 5)
Qvazar
post 18.04.2006, 07:55:48
Post #2





Grupa: Zarejestrowani
Postów: 41
Pomógł: 3
Dołączył: 28.10.2005

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


  1. <?php
  2.  
  3. <form action="index.php?submit_poile='. $int_poile .'" method="post">
  4.  
  5. ?>
Go to the top of the page
+Quote Post
droicyn
post 18.04.2006, 09:32:01
Post #3





Grupa: Zarejestrowani
Postów: 6
Pomógł: 0
Dołączył: 12.04.2006

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


to nie działa :/ kombinuje z tymi zmiennymi ale i tak nie pamieta, ze powinien sortowac np 1 newsie na stronie! W sumie nie wiem gdzie mam blad :/

Ten post edytował droicyn 18.04.2006, 09:32:19
Go to the top of the page
+Quote Post
Qvazar
post 18.04.2006, 10:25:39
Post #4





Grupa: Zarejestrowani
Postów: 41
Pomógł: 3
Dołączył: 28.10.2005

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


Z tego co zauważyłem odwołujesz się do $_POST['submit_poile'], a w form i odnośnikach używasz zmienej $po
Go to the top of the page
+Quote Post
droicyn
post 18.04.2006, 20:11:52
Post #5





Grupa: Zarejestrowani
Postów: 6
Pomógł: 0
Dołączył: 12.04.2006

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


tzn mozesz troche jasniej!? bo ja nigdzie nie uzywam zmiennej $po!!! jakbys mogl to prosze napisz jasniej z gory wielkie dzieki!!! pozdro dla Ciebie
Go to the top of the page
+Quote Post
kwiateusz
post 18.04.2006, 23:22:40
Post #6


Admin Techniczny


Grupa: Administratorzy
Postów: 2 071
Pomógł: 93
Dołączył: 5.07.2005
Skąd: Olsztyn




index.php?po <-- tu jest zmienna po

linia 102,117,144
Go to the top of the page
+Quote Post

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 Wersja Lo-Fi Aktualny czas: 24.07.2025 - 14:31