ok, something really isnt working here.
I am creating a forum and i have a page for viewing the topics.
The first initial topic is diplayed forst and then any other replies are displayed after.
Except it only ever shows one reply. Im using a While loop and i dunno whats wrong. Its quite a logn code, but here it is for anyone who can helop me?!?!
//Ok, so we need to display the post which was selected.
//We retrieve the post from the database from the variables provided by the user when they clicked on the link.
$query = "SELECT * FROM forum WHERE PostID='$PostID' AND ForumID='$ForumID'";
$result = mysql_query($query);
CheckMySQL();
//Now we put the selected post's details into an array
$row = mysql_fetch_array($result);
//Also, so we don't have to keep switching between queries lets set some variables about the initial post
$POST = "$row[post]";
$ViewCount = $row[views];
$ViewCount++;
?>
<!-- This table is to seperate the tools and the posts -->
<table border="0" width="100%"><tr><td width="650">
<table border="2" bordercolor="darkred" width="95%">
<tr>
<td bgcolor="darkred"><b><font face=<?php echo ($font_face); ?> color=<?php echo ($font_color); ?> size="3"><?php echo ("$row[subject]"); ?></font></b></td>
</tr><tr><td bgcolor="darkred">
<?php
//We first echo all the information about the poster
echo ("<table border=\"0\" width=\"100%\"><tr>\n");
//We need to get a bit of information about the user who posted this post.
//So, once again, we ask our good pal MySQL to get it for us
$query = "SELECT * FROM userinfo WHERE username='$row[posted_by]'";
$result = mysql_query($query);
CheckMySQL();
//And to make it possible to get all the information easily, we put $result into an array
$row = mysql_fetch_array($result);
//Now we can go about putting his information on screen
//But before we do that we want to give the poster a rating dependant on the anout of posts the poster has
if ($row[post_count] < 50) { $rating = "Newbie"; }
elseif (($row[post_count] >= 50) && ($row[post_cout] < 100 )) { $rating = "Advanced"; }
elseif (($row[post_count] >= 100) && ($row[post_cout] < 150 )) { $rating = "Pro"; }
elseif (($row[post_count] >= 150) && ($row[post_cout] < 200 )) { $rating = "Junkie"; }
elseif (($row[post_count] >= 200) && ($row[post_cout] < 250 )) { $rating = "Wicked"; }
elseif (($row[post_count] >= 250) && ($row[post_cout] < 300 )) { $rating = "Gnarly"; }
elseif (($row[post_count] >= 300) && ($row[post_cout] < 350 )) { $rating = "Dedicated"; }
elseif (($row[post_count] >= 350) && ($row[post_cout] < 400 )) { $rating = "Needs out more"; }
elseif (($row[post_count] >= 400) && ($row[post_cout] < 500 )) { $rating = "No Life"; }
elseif (($row[post_count] >= 500) && ($row[post_cout] < 600 )) { $rating = "Ridiculous"; }
elseif (($row[post_count] >= 600) && ($row[post_cout] < 750 )) { $rating = "Insane!"; }
elseif (($row[post_count] >= 750) && ($row[post_cout] < 950 )) { $rating = "Feel sorry for me"; }
elseif ($row[post_count] >= 950) { $rating = "Legend"; }
echo ("<td valign=\"top\" width=\"75\">\n");
echo ("<b><font face=$font_face size=\"2\">$row[username]</b>\n");
echo ("<br><font size=\"1\">$row[post_count] posts<br>");
echo ("$rating\n");
echo ("</font></font></td>\n");
//Noe we echo the post using the variable we created earlier
echo ("<td>$POST\n");
//And if the poster has a signature, well, we'll echo that too!
//But first we have to select the user's details from the userinfo table
$query = "SELECT * FROM userinfo WHERE username='$row[posted_by]'";
$result = mysql_query($query);
CheckMySQL();
//Now put the results into an array
$row = mysql_fetch_array($result);
//Now that we have done that we determine whether his signature has been set.
if (($row[signature] != "empty") OR ($row[signature] != "")) { echo ("<p><table border=\"0\"><tr><td><font size=\"2\">$row[signature]</font></td></tr></table>"); }
else { }
echo ("</td></tr></table>\n");
//If there are any replies we have to echo them too.
//Although first we have to search the database.
$query = "SELECT * FROM forum_replies";
$result = mysql_query($query);
CheckMySQL();
//Using this while loop we echo all the replies made to this post.
While ($row = mysql_fetch_array($result))
{
//We first echo all the information about the poster
echo ("<hr color=\"#000000\" width=\"100%\">");
echo ("<table border=\"0\" width=\"100%\"><tr>\n");
//We need to get a bit of information about the suer who posted this post.
//So, once again, we ask our good pal MySQL to get it for us
$query = "SELECT * FROM userinfo WHERE username='$row[posted_by]'";
$result = mysql_query($query);
CheckMySQL();
//And to make it possible to get all the information easily, we put $result into an array
$row = mysql_fetch_array($result);
//Now we can go about putting his information on screen
//But before we do that we want to give the poster a rating dependant on the anout of posts the poster has
if ($row[post_count] < 50) { $rating = "Newbie"; }
elseif (($row[post_count] >= 50) && ($row[post_cout] < 100 )) { $rating = "Advanced"; }
elseif (($row[post_count] >= 100) && ($row[post_cout] < 150 )) { $rating = "Pro"; }
elseif (($row[post_count] >= 150) && ($row[post_cout] < 200 )) { $rating = "Junkie"; }
elseif (($row[post_count] >= 200) && ($row[post_cout] < 250 )) { $rating = "Wicked"; }
elseif (($row[post_count] >= 250) && ($row[post_cout] < 300 )) { $rating = "Gnarly"; }
elseif (($row[post_count] >= 300) && ($row[post_cout] < 350 )) { $rating = "Dedicated"; }
elseif (($row[post_count] >= 350) && ($row[post_cout] < 400 )) { $rating = "Needs out more"; }
elseif (($row[post_count] >= 400) && ($row[post_cout] < 500 )) { $rating = "No Life"; }
elseif (($row[post_count] >= 500) && ($row[post_cout] < 600 )) { $rating = "Ridiculous"; }
elseif (($row[post_count] >= 600) && ($row[post_cout] < 750 )) { $rating = "Insane!"; }
elseif (($row[post_count] >= 750) && ($row[post_cout] < 950 )) { $rating = "Feel sorry for me"; }
elseif ($row[post_count] >= 950) { $rating = "Legend"; }
echo ("<td valign=\"top\" width=\"75\">\n");
echo ("<b><font face=$font_face size=\"2\">$row[username]</b>\n");
echo ("<br><font size=\"1\">$row[post_count] posts<br>");
echo ("$rating\n");
echo ("</font></font></td>\n");
//Because we had to change the MySQL query so as to be able to select all the post_count information we have to call the post up again.
//Why? So we can display the post!!!
$query = "SELECT * FROM forum_replies WHERE reply_to_PostID='$PostID'";
$result = mysql_query($query);
CheckMySQL();
//Now we put the selected post's details into an array
$row = mysql_fetch_array($result);
echo ("<td>$row[post]\n");
//And if the poster has a signature, well, we'll echo that too!
//But first we have to select the user's details from the userinfo table
$query = "SELECT * FROM userinfo WHERE username='$row[posted_by]'";
$result = mysql_query($query);
CheckMySQL();
//Now put the results into an array
$row = mysql_fetch_array($result);
//Now that we have done that we determine whether his signature has been set.
if (($row[signature] != "empty") OR ($row[signature] != "")) { echo ("<p><table border=\"0\"><tr><td><font size=\"2\">$row[signature]</font></td></tr></table>"); }
else { }
echo ("</td></tr></table>\n");
}
//finally, now that everything has been displayed properly (hopefully!) we need to update the view count for this post.
//To do this we use the UPDATE query and add one to the count.
$query = "UPDATE forum SET views='$ViewCount' WHERE PostID='$PostID'";
$result = mysql_query($query);
CheckMySQL();
?>
</td></tr>
<tr><td bgcolor="darkred"><b>
<font face=<?php echo ($font_face); ?> color=<?php echo ($font_color); ?> size="2">POWERED BY MOUNTAINCANON FORUM V1.0</font>
</b></td></tr></table>
<p>