Fehler: nur ein Ergebnis

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • Fehler: nur ein Ergebnis

    Hi!

    Ich habe folgendes Problem mit dem Code:

    Quellcode

    1. <?php
    2. $sql2 = "SELECT * FROM ".$praefix."_board WHERE board_cat_id = ".$row['cat_id']." ORDER BY board_order ASC";
    3. $result2 = new Query($sql2) or die(mysql_error());
    4. $numrows = $result2->numRows();
    5. if ($numrows == 0) {
    6. $nothing = 0;
    7. }
    8. else {
    9. while($row2 = $result2->fetch()) {
    10. if (!isset($_SESSION["user_id"])) {
    11. $see_board = 0;
    12. }
    13. else {
    14. $use2_sql = "SELECT * FROM ".$praefix."_user WHERE user_id = ".$_SESSION["user_id"];
    15. $use2_query = new Query($use2_sql);
    16. $usw2_row = $use2_query->fetch();
    17. $user_rank = "SELECT * FROM ".$praefix."_rank WHERE rank_id = ".$usw2_row["user_rank"];
    18. $user_query = new Query($user_rank);
    19. $user_row = $user_query->fetch();
    20. $see_board = $user_row["rank_see_board"];
    21. }
    22. if ($row2["board_status"] == 1 or $see_board == 1) {
    23. $sql3 = "SELECT
    24. a.`thread_title`,
    25. a.`thread_date`,
    26. a.`thread_autor`,
    27. a.`thread_status`,
    28. a.`thread_id`,
    29. b.`user_name`,
    30. b.`user_id`,
    31. (SELECT c.`post_date` FROM `".$praefix."_post` AS c WHERE c.`post_thread_id` = a.`thread_id` ORDER BY c.`post_date` DESC LIMIT 1) AS `date`
    32. FROM
    33. `".$praefix."_thread` AS a
    34. LEFT JOIN
    35. `".$praefix."_user` AS b
    36. ON
    37. a.`thread_autor` = b.`user_name`
    38. WHERE
    39. a.`thread_board_id` = '".mysql_real_escape_string($row2['board_id'])."'
    40. ORDER BY
    41. `date` DESC,
    42. a.`thread_date` DESC
    43. LIMIT
    44. 1";
    45. $result3 = new Query($sql3);
    46. $row3 = $result3->fetch();
    47. $sql5 = "SELECT * FROM ".$praefix."_post WHERE post_thread_id = ".$row3['thread_id'];
    48. $result5 = new Query($sql5);
    49. $num5 = $result5->numRows();
    50. if ($num5 != 0) {
    51. if (strlen($row3['thread_title']) > 25) {
    52. $thread_post = "SELECT * FROM ".$praefix."_post WHERE post_thread_id = ".$row3["thread_id"]." ORDER BY `post_date` DESC LIMIT 1";
    53. $thread_query = new Query($thread_post);
    54. $thread_row = $thread_query->fetch();
    55. $post_autor = "SELECT * FROM ".$praefix."_user WHERE user_name = '".$thread_row["post_autor"]."'";
    56. $post_query = new Query($post_autor);
    57. $post_row = $post_query->fetch();
    58. $smarty->assign("userid",$post_row["user_id"]);
    59. $smarty->assign("boardautor",$post_row["user_name"]);
    60. $threadtitel = "Re: ".substr($row3['thread_title'],0,17)."...";
    61. }
    62. else {
    63. $sql6 = "SELECT * FROM ".$praefix."_thread WHERE thread_board_id = ".$row2['board_id'];
    64. $result6 = new Query($sql6) or die(mysql_error());
    65. $numRow6 = $result6->numRows();
    66. if ($numRow6 == 0) {
    67. $threadtitel = "";
    68. $smarty->assign("userid" ,'');
    69. $smarty->assign("boardautor",'');
    70. }
    71. else {
    72. $thread_post = "SELECT * FROM ".$praefix."_post WHERE post_thread_id = ".$row3["thread_id"]." ORDER BY `post_date` DESC LIMIT 1";
    73. $thread_query = new Query($thread_post);
    74. $thread_row = $thread_query->fetch();
    75. $post_autor = "SELECT * FROM ".$praefix."_user WHERE user_name = '".$thread_row["post_autor"]."'";
    76. $post_query = new Query($post_autor);
    77. $post_row = $post_query->fetch();
    78. $smarty->assign("userid",$post_row["user_id"]);
    79. $smarty->assign("boardautor",$post_row["user_name"]);
    80. $threadtitel = "Re: ".$row3['thread_title'];
    81. }
    82. }
    83. }
    84. else {
    85. $smarty->assign("userid",$row3["user_id"]);
    86. $smarty->assign("boardautor",$row3["user_name"]);
    87. if (strlen($row3['thread_title']) > 25) {
    88. $threadtitel = substr($row3['thread_title'],0,18)."...";
    89. }
    90. else {
    91. $threadtitel = $row3['thread_title'];
    92. }
    93. }
    94. $sql_100 = "SELECT * FROM ".$praefix."_thread WHERE thread_board_id = ".$row2['board_id'];
    95. $result_100 = new Query($sql_100) or die(mysql_error());
    96. $num_rows10 = $result_100->numRows();
    97. if ($num_rows10 == 0) {
    98. $smarty->assign("on_closed_off",'<img src="images/nopost.gif" alt="Nichts neues" />');
    99. }
    100. else {
    101. if ($row3['thread_status'] == 1) {
    102. $smarty->assign("on_closed_off",'<img src="images/closed.gif" alt="Gesperrt" />');
    103. }
    104. else {
    105. if (!isset($_SESSION["user_id"])) {
    106. $smarty->assign("on_closed_off",'<img src="images/off.gif" alt="Nichts neues" />');
    107. }
    108. else {
    109. $sql4 = "SELECT * FROM ".$praefix."_unread_topic WHERE unread_user_id = ".$_SESSION["user_id"];
    110. $result4 = new Query($sql4) or die(mysql_error());
    111. $row4 = $result4->fetch();
    112. $numRow4 = $result4->numRows();
    113. if ($row4["unread_thread_id"] != $row3["thread_id"]) {
    114. if ($row3['thread_status'] == 2) {
    115. $smarty->assign("on_closed_off",'<img src="images/thread_offAlert.gif" alt="Wichtiges Thema" />');
    116. }
    117. elseif ($row3['thread_status'] == 3) {
    118. $smarty->assign("on_closed_off",'<img src="images/thread_offAttachment.gif" alt="Ankündigung" />');
    119. }
    120. elseif ($row3['thread_status'] == 4) {
    121. $smarty->assign("on_closed_off",'<img src="images/off.gif" alt="Nichts neues" />');
    122. }
    123. }
    124. else {
    125. if ($row3['thread_status'] == 2) {
    126. $smarty->assign("on_closed_off",'<img src="images/thread_onAlert.gif" alt="Wichtiges Thema" />');
    127. }
    128. elseif ($row3['thread_status'] == 4) {
    129. $smarty->assign("on_closed_off",'<img src="images/on.gif" alt="Neu" />');
    130. }
    131. elseif ($row3['thread_status'] == 3) {
    132. $smarty->assign("on_closed_off",'<img src="images/thread_onAttachment.gif" alt="Ankündigung" />');
    133. }
    134. }
    135. }
    136. }
    137. }
    138. // und so weiter
    139. ?>
    Alles anzeigen


    Also:
    Es wird nur ein ungelesenes Thema angezeigt. Egal welches Forum.
    Aber der Themenstatus: Ankündigung, Wichtig oder Normal wird angezeigt.

    Hat jemand eine lösung?