Hjælp til forum - samme topic vises flere gange
Hej,Jeg har kastet mig ud i at lave et forum.
Jeg har fået det til at virker stortset, men jeg har et lille, eller retter stor problem med visning af topics, den viser i oversigten det samme topic, det antal gange der et svar/post i det, så hvis et topic har 2 posts så vises topic 2 gange.
her er koden:
<?
$fetch_topic = mysql_query("SELECT * FROM jboard_topic as jbt, jboard_posts as jbp, jboard_users as jbu WHERE jbu.uid = jbt.uid AND jbp.fid = jbt.fid AND jbt.fid = '$forum_fid' ORDER BY jbp.pid") or die(mysql_error());
while($forum_topic = mysql_fetch_array($fetch_topic))
{
$fetch_posts = mysql_query("SELECT * FROM jboard_posts WHERE tid = '$forum_topic[tid]'") or die(mysql_error());
$forum_posts = mysql_num_rows($fetch_posts);
$fetch_lastpost = mysql_query("SELECT * FROM jboard_posts AS jbp, jboard_users AS jbu WHERE jbu.uid = jbp.uid AND jbp.tid = '$forum_topic[tid]' ORDER BY pid DESC LIMIT 1") or die(mysql_error());
$forum_lastpost = mysql_fetch_array($fetch_lastpost);
?>
<tr>
<td class="jboard_forum_topic" align="center" width="30" height="30"></td>
<td class="jboard_forum_topic" align="left" height="30"><a href="topic.php?fid=<? echo $forum_topic[fid]; ?>&tid=<? echo $forum_topic[tid]; ?>"><b><? echo $forum_topic[topic]; ?></b></a></td>
<td class="jboard_forum_topic" align="center" width="100" height="30"><a href="user.php?uid=<? echo $forum_topic[uid]; ?>"><b><? echo $forum_topic[username]; ?></b></td>
<td class="jboard_forum_topic" align="center" width="50" height="30"><? echo $forum_posts; ?></td>
<td class="jboard_forum_topic" align="center" width="50" height="30"></td>
<td class="jboard_forum_topic" align="center" width="150" height="30"><a href="user.php?uid=<? echo $forum_lastpost[uid]; ?>"><b><? echo $forum_lastpost[username]; ?></b></a><br /><? echo $forum_lastpost[date]; ?></td>
<td class="jboard_forum_topic" align="center" width="30" height="30"></td>
</tr>
<?
}
?>
jeg ar sat den til at sotere efter posts (pid), da de nyeste altid skal vises øverst.
Er der nogen der kan se hvorfor det ikke virker?
evt.kig her: www.jollynet.dk/forum/forum.php?fid=1