I made changes to this, so the correct no. of pages would come out, but the topics still don't show! What is wrong?
//Count the number of threads and pages
$countrows = mysql_query("SELECT * FROM topics WHERE forum='$forum'", $connect);
$numtopics = mysql_num_rows($countrows);
$numpages = intval($numtopics/20);
if($numpages < 1)
{
$numpages = 1;
}
$numlast = $numtopics % 20;
if($numlast != 0)
{
$numpages++;
}
//Which topics to display
if($page != 1 && $numtopics > 20)
{
$last = (20 $page) - 20;
$first = 20 $page;
}
if($page == 1 && $numtopics > 20)
{
$last = 1;
$first = 20 - $numlast;
}
if(numtopics <=20)
{
$last = 1;
$first = $numtopics;
}
?>
<CENTER>
<TABLE>
<?
//List the topics
if($addpost == "no" || !$addpost)
{
for($count=$first; count>=$last; $count--)
{
$dummy = mysql_query("SELECT FROM topics WHERE number='$count'", $connect);
$check = mysql_fetch_array($dummy);
if($forum == $check[forum])
{
$thread[$count] = $check;
}
if($forum != $check[forum])
{
$count++;
}
}
for($count=20; count>=$last; $count--)
{
echo "<TR>";
$current++;
$whatever2=mysql_query("SELECT FROM posts WHERE thread='$thread[$count][title]'", $connect);
$numposts=mysql_num_rows($whatever2);
echo "<TD WIDTH='30%'><A HREF='http://forum.levx.net/postview.php?thread=".$thread[$count][title]."&page=1&addpost=no&forum=".$forum.">".$thread[$count][title]."</A></TD><TD WIDTH='15%'>".$thread[$count][user]."</TD><TD WIDTH='5%'>".$numposts."</TD><TD WIDTH='50%'>".dconvert($thread[$count][date])."</TD></TR>";
if($count == 20)
{
echo "</TABLE>";
}
}