doddsey_65 Posted July 6, 2010 Share Posted July 6, 2010 the following is the code for my homepage (WIP) and the 2nd page which is displayed via get. however when the second page is displayed the ifrst one is displayed under neath and nothing displays on the first page. This is usually solved via a elseif or else which i have included but it still isnt working. <?php include 'includes/header.php'; include 'config/config.php'; # When displaying the list of topics # if (isset($_GET['forum'])) { $forumid = $_GET['forum']; ?> <div id="content_holder"> <table id="forum_table"> <tr> <td id="forum_name">Topic</td> <td id="forum_count">Replies</td> <td id="forum_count">Views</td> <td id="forum_stats">Last Post</td> <?php $sql = mysql_query(" SELECT * FROM $tbl_topics WHERE forum_id = $forumid") or die (mysql_error()); while($row = mysql_fetch_object($sql)) { echo '<tr><td id="forum_name"><p>' . $row->topic_name . '</p><p>' . $row->topic_poster . '</p></td><td id="forum_count"><p>' . $row->topic_replies . '</p></td><td id="forum_count"><p>' . $row->topic_views . '</p></td><td id="forum_stats"><p>'; if (!$row->topic_last_poster) { echo 'No Replies'; } else { echo $row->topic_last_poster . '</p><p>' . date("F j, Y, g:i a", strtotime($row->topic_last_post_time)); } echo '</p></td></tr>'; } ?> </table> </div> <? } else { ?> <!-- When displaying the home page (list of forums) --> <div id="content_holder"> <table id="forum_table"> <tr> <td id="forum_name">Forum</td> <td id="forum_count">Topics</td> <td id="forum_count">Posts</td> <td id="forum_stats">Last Post</td> <?php $sql = mysql_query("SELECT * FROM $tbl_forums") or die (mysql_error()); while($row = mysql_fetch_object($sql)) { echo '<tr><td id="forum_name"><p> <a href="index.php?forum=' . $row->forum_id . '">' . $row->forum_name . '</a></p><p>' . $row->forum_description . '</p></td><td id="forum_count"><p>' . $row->forum_topics . '</p></td><td id="forum_count"><p>' . $row->forum_posts . '</p></td><td id="forum_stats"><p>'; if (!$row->forum_last_poster) { echo 'No Posts'; } else { echo $row->forum_last_poster . '</p><p>' . date("F j, Y, g:i a", strtotime($row->forum_last_post_time)); } echo '</p></td></tr>'; } ?> </table> </div> <?php } ?> Quote Link to comment https://forums.phpfreaks.com/topic/206858-display-error/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.