Jump to content

display error


doddsey_65

Recommended Posts

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 } ?>

Link to comment
https://forums.phpfreaks.com/topic/206858-display-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.