Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php/mysql] problem z skryptem logowania
Majcok12
post
Post #1





Grupa: Zarejestrowani
Postów: 54
Pomógł: 0
Dołączył: 20.02.2004

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


Mam problem z systemem newsow, tzn. zrobilem link "wiecej" w ktorym bedzie zawarta dalsza czesc newsa i tu jest problem, gdyz gdy klikam wiecej w obojetnie jakim newsie zawsze w stronie, ktora sie otworzy jest dalsza czesc newsa, ale ostatniego, ktory jest pobierany z bazy danych i nie wiem jak sobie z tym poradzic.
ponizej kod skryptu:
  1. <?php
  2. include &#092;"common.php\";
  3.  
  4. global $id_polaczenia;
  5. $id_polaczenia = db_connect();
  6. if(!$id_polaczenia) error_message(sql_error());
  7.  
  8. html_header();
  9. echo &#092;"<TR>n\";
  10. echo &#092;"<TD WIDTH=\"100%\" HEIGHT=\"16\" background=\"layout/belka2.gif\" style=\"border-bottom: solid; border-bottom-width: 1px; border-bottom-color: black;\"><center><font style=\"font-family: Times New Roman; font-size: 8pt;\"><b>News</b></center></TD>n\";
  11. echo &#092;"</TR>n\";
  12. echo &#092;"</table>n\";
  13. echo &#092;"<TABLE BORDER=\"0\" cellpadding=\"1\" cellspacing=\"0\" WIDTH=\"100%\" HEIGHT=\"1200\" BGCOLOR=\"#000000\" style=\"border-left: solid; border-left-width: 1px; border-left-color: black; border-bottom: solid; border-bottom-width: 1px; border-bottom-color: black; border-right: solid; border-right-width: 1px; border-right-color: black;\">n\";
  14. echo &#092;" <TR>n\";
  15. echo &#092;"  <TD valign=\"top\" align=\"left\" bgcolor=\"#414141\" colspan=\"3\">n\";
  16. echo &#092;"<br>n\";
  17.  
  18. $query = &#092;"SELECT news_headline, add_ndate, autor, news_contents, more, news_id, edit_
    n
  19. m FROM news ORDER BY news_num DESC LIMIT 0, 6\";
  20. $wynik = mysql_query($query);
  21. if(!$wynik) error_message(sql_error());
  22.  
  23. while ($q_data = mysql_fetch_array($wynik)) {
  24.     $naglowek = $q_data[\"news_headline\"];
  25.     $data = $q_data[\"add_ndate\"];
  26.     $autor = $q_data[\"autor\"];
  27.     $zawartosc_p = $q_data[\"news_contents\"];
  28.     $zawartosc_k = $q_data[\"more\"];
  29.     $id_news = $q_data[\"news_id\"];
  30.     $edit_n = $q_data[\"edit_num\"];
  31.  
  32. echo \"<font style=\"margin-left: 5pt; font-family: Verdana; font-size: 9pt; color: gray;\"><b> $naglowek </b><br>n\";
  33. echo \"<font style=\"margin-left: 5pt; font-family: Verdana; font-size: 9px; color: darkgray;\"> $data <br>n\";
  34.  
  35. echo \" <table border=\"0\" cellpadding=\"1\" cellspacing=\"0\" width=\"480\">n\";
  36. echo \" <tr>n\";
  37. echo \" <td align=\"center\" width=\"480\">n\";
  38. echo \"   <table border=\"0\" cellpadding=\"1\" cellspacing=\"0\" width=\"450\">n\";
  39. echo \"    <tr>n\";
  40. echo \"     <td align=\"center\" width=\"450\">n\";
  41. echo \"      <DIV ALIGN=\"justify\">n\";
  42. echo \"<font style=\"font-family: Verdana; font-size: 10px; color: gray;\">n\";
  43. echo \"$zawartosc_p n\";
  44. echo \"            </div>n\";
  45. echo \"          </td>n\";
  46. echo \"        </tr>n\";
  47. echo \"     </table>n\";
  48. echo \" </td>n\";
  49. echo \" </tr>n\";
  50. echo \" <tr>n\";
  51. echo \" <td align=\"left\" with\"480\">n\";
  52. echo \" &nbsp;<a target=\"blank\" href=\"index.php?action=view_r&id_news=$id_news\"><font style=\"font-family: Verdana; font-size: 9px;\"><i>Wiecej</i></a><br>n\";
  53. if(!$edit_n == 0) {
  54. echo \" &nbsp;&nbsp;&nbsp;<font style=\"font-family: Verdana; font-size: 9px;\"><i>Edytowano $edit_n razy</i><br>n\";
  55. }
  56. echo \" </td>n\";
  57. echo \" </tr>n\";
  58. echo \" </table>n\";
  59.  
  60. echo \"<center>n\";
  61. echo \"<img src=\"layout/l.jpg\">n\";
  62. echo \"</center>n\";
  63. echo \"<br>n\";
  64. }
  65. echo \"</td>n\";
  66. echo \"</TR>n\";
  67. echo \"</TABLE>n\";
  68. html_footer();
  69.  
  70. function view_r() {
  71.     global $id_news;
  72.     $query = \"SELECT news_headline, add_ndate, autor, news_contents, more, edit_num FROM n
  73. ws WHERE news_id = '$id_news'\";
  74.     $wynik = mysql_query($query);
  75.     if(!$wynik) error_message(sql_error());
  76.     $q_data = mysql_fetch_array($wynik);
  77.  
  78.     $naglowek = $q_data[\"news_headline\"];
  79.     $data = $q_data[\"add_ndate\"];
  80.     $autor = $q_data[\"autor\"];
  81.     $zawartosc_p = $q_data[\"news_contents\"];
  82.     $zawartosc_k = $q_data[\"more\"];
  83.     $edit_n = $q_data[\"edit_num\"];
  84.  
  85.     html_header();
  86. echo \"<TR>n\";
  87. echo \"<TD WIDTH=\"100%\" HEIGHT=\"16\" background=\"layout/belka2.gif\" style=\"border-bottom: solid; border-bottom-width: 1px; border-bottom-color: black;\"><center><font style=\"font-family: Times New Roman; font-size: 8pt;\"><b>News</b></center></TD>n\";
  88. echo \"</TR>n\";
  89. echo \"</table>n\";
  90. echo \"<TABLE BORDER=\"0\" cellpadding=\"1\" cellspacing=\"0\" WIDTH=\"100%\" HEIGHT=\"1200\" BGCOLOR=\"#000000\" style=\"border-left: solid; border-left-width: 1px; border-left-color: black; border-bottom: solid; border-bottom-width: 1px; border-bottom-color: black; border-right: solid; border-right-width: 1px; border-right-color: black;\">n\";
  91. echo \" <TR>n\";
  92. echo \"  <TD valign=\"top\" align=\"left\" bgcolor=\"#414141\" colspan=\"3\">n\";
  93. echo \"<br>n\";
  94.  
  95. echo \"<font style=\"margin-left: 5pt; font-family: Verdana; font-size: 9pt; color: gray;\"><b> $naglowek </b><br>n\";
  96. echo \"<font style=\"margin-left: 5pt; font-family: Verdana; font-size: 9px; color: darkgray;\"> $data <br>n\";
  97.  
  98. echo \" <table border=\"0\" cellpadding=\"1\" cellspacing=\"0\" width=\"480\">n\";
  99. echo \" <tr>n\";
  100. echo \" <td align=\"center\" width=\"480\">n\";
  101. echo \"   <table border=\"0\" cellpadding=\"1\" cellspacing=\"0\" width=\"450\">n\";
  102. echo \"    <tr>n\";
  103. echo \"     <td align=\"center\" width=\"450\">n\";
  104. echo \"      <DIV ALIGN=\"justify\">n\";
  105. echo \"<font style=\"font-family: Verdana; font-size: 10px; color: gray;\">n\";
  106. echo \"$zawartosc_p  <br><br>n\";
  107. echo \"$zawartosc_k n\";
  108. echo \"            </div>n\";
  109. echo \"          </td>n\";
  110. echo \"        </tr>n\";
  111. echo \"     </table>n\";
  112. echo \" </td>n\";
  113. echo \" </tr>n\";
  114. if(!$edit_n == 0) {
  115. echo \" <tr>n\";
  116. echo \" <td align=\"left\" with\"480\">n\";
  117. echo \" &nbsp;&nbsp;&nbsp;<font style=\"font-family: Verdana; font-size: 9px;\"><i>Edytowano $edit_n razy</i><br>n\";
  118. echo \" </td>n\";
  119. echo \" </tr>n\";
  120. }
  121. echo \" </table>n\";
  122.  
  123. echo \"<center>n\";
  124. echo \"<img src=\"layout/l.jpg\">n\";
  125. echo \"</center>n\";
  126. echo \"<br>n\";
  127. echo \"</td>n\";
  128. echo \"</TR>n\";
  129. echo \"</TABLE>n\";
  130. html_footer();
  131.  
  132.  
  133.  
  134. }
  135.  
  136. switch($action) {
  137.     case \"view_r\";
  138.     view_r();
  139.     break;
  140. }
  141.  
  142. ?>



Prosze o pomoc.

Pzdr

Ten post edytował Majcok12 20.10.2004, 18:13:40
Go to the top of the page
+Quote Post

Posty w temacie
- Majcok12   [php/mysql] problem z skryptem logowania   16.10.2004, 21:30:44
- - ARJ   więc tak zaczne od drobnej porady: po co utrudnias...   16.10.2004, 21:40:11
- - Majcok12   Lista newsow. A jak by to wygladalo, gdy na stroni...   16.10.2004, 21:51:27
- - ARJ   jak pokazujesz newsa to dajesz np. w jego tytule l...   16.10.2004, 22:19:39
- - Majcok12   Nie wiem, czy dobrze zrozumialem, Zrobilem to tak:...   18.10.2004, 21:04:59
- - Fibolg   Prawdopodobnie masz akurat ustawioną zmienną ID na...   19.10.2004, 07:16:32
- - ARJ   skrypt dałeś niepełny ale chyba wiem o co chodzi. ...   19.10.2004, 12:19:45
- - Majcok12   Cytat(ARJ @ 2004-10-19 13:19:45)skrypt dałeś ...   19.10.2004, 12:53:46
- - ARJ   zaglądnij w ten topic http://forum.php.pl/index.ph...   19.10.2004, 22:40:12
- - Majcok12   Wykorzystalem twoj pomysl, ale pewnie cos zle zrob...   20.10.2004, 09:10:25
- - ARJ   twój kod jest bardziej zaawansowany niż mój. po dł...   20.10.2004, 13:02:43
- - Majcok12   RE: [php/mysql] problem z skryptem logowania   20.10.2004, 17:58:05
- - ARJ   Cytat(Majcok12 @ 2004-10-20 18:58:05)57 [PHP]...   20.10.2004, 19:48:45
- - Majcok12   Zmienilem skrypt tak jak napisales i to samo. Pro...   20.10.2004, 20:20:38
- - ARJ   a jeśli dasz [PHP] pobierz, plaintext <?  ...   20.10.2004, 21:24:21
- - Majcok12   Cytat(ARJ @ 2004-10-20 22:24:21)a jeśli dasz ...   21.10.2004, 20:24:46
- - ARJ   tylko po co wracać na tą stronę? ona loguje tylko ...   22.10.2004, 15:46:15
- - Majcok12   Zapomnialem napisac. Chociaz po podaniu poprawnych...   23.10.2004, 14:36:50


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: 22.09.2025 - 10:28