Im coding a very basic message board. The following is code for the index page which displays all the thread's names. It all works apart from one thing and thats a bit of work I did to find the number of posts that are under each thread. Now it works right but the problem is it seems to stop the while{} thing from showing all the other threads. As it stands it just gets to the post count then stops. If I take that bit of code out it works fine and lists all the threads. Any ideas?
$query = "SELECT thread_id, date, last_update, poster, subject, post_id, message FROM forums WHERE post_id='1' ORDER BY last_update DESC";
while($row = mysql_fetch_object($result))
{
?>
<? echo $row->thread_id; ?>
<? echo $row->date; ?>
etc etc...
//The following is the code used to find out number of posts made in each thread
<?
$query = "SELECT post_id FROM mw_forums WHERE thread_id='$row->thread_id' ORDER BY post_id DESC LIMIT 0,1";
$result = mysql_db_query($database, $query, $connection) or die ("Could not execute query: $query. " . mysql_error());
$row = mysql_fetch_object($result);
echo $row->post_id;
?>
<?
}
?>