I'm currently coding a forum of my own, and need some help. I have all the information stored in a MySQL database in the same table but on different rows (author, date, subject, body, etc.) and I would like the threads on the main page to be displayed in such a way so that the most-recently replied-to topic is at the top. Now, I have been displaying the topics by using the following snippet:
mysql_connect(myhost,myuser,mypass);
$displaynews=mysql(myname,"select * from newsposts"
$newsnum=mysql_numrows($displaynews);
for($i=0;$i<$numrows;$i++)
{
$newsauthor=mysql_result($newsdisplay,i,"author"
$newstitle=mysql_result($newsdisplay,i,"title"
$newsdate=mysql_result($newsdisplay,i,"date"
$newsbody=mysql_result($newsdisplay,i,"body"
echo "<P>$subject<P>$author - $date<BR>$body<P>";
}
What this does is display the topics so that the one most recently _POSTED_ is on the top, and the next recent one is next, and so on. However, what I want to make it do is have the most recently _REPLIED TO_ topic on the top, and so on. Is there a way for me to do this? [sig][/sig]
mysql_connect(myhost,myuser,mypass);
$displaynews=mysql(myname,"select * from newsposts"
$newsnum=mysql_numrows($displaynews);
for($i=0;$i<$numrows;$i++)
{
$newsauthor=mysql_result($newsdisplay,i,"author"
$newstitle=mysql_result($newsdisplay,i,"title"
$newsdate=mysql_result($newsdisplay,i,"date"
$newsbody=mysql_result($newsdisplay,i,"body"
echo "<P>$subject<P>$author - $date<BR>$body<P>";
}
What this does is display the topics so that the one most recently _POSTED_ is on the top, and the next recent one is next, and so on. However, what I want to make it do is have the most recently _REPLIED TO_ topic on the top, and so on. Is there a way for me to do this? [sig][/sig]