Sorry about that,... its just that i dont know which part is non-functioning. If I did, my problems would be solved lightning-fast.
I have a table of threads from multiple forums. The script has to count the number of threads from the current forum and then calculate the starting and ending 2 IDs with which it will use in the thread-displaying loop. The oldest threads have lower IDs and the newer ones have higher IDs, so the loop goes downwards.
Everything is to be sorted in pages of 20 threads, with page #1 (right now) being the last page.
And you can find this at forum.levx.net(expect to find stupid posts like "i farted" (hehe), been testing) I know i can MAKE threads)
//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;
}