0 and thread > $back order by thread limit $nDisplay"; } elseif($more!=""){ $sSQL = "Select thread from $sTable where thread <>0 and thread < $more order by thread desc limit $nDisplay"; } else{ $sSQL = "Select thread from $sTable where thread <>0 order by thread desc limit $nDisplay"; } $nThreads = mysql_db_query($sDB, $sSQL, $nConnection); $nRows = mysql_num_rows ( $nThreads ); if($nRows<$nDisplay){ if($back!=""){ $sSQL = "Select thread from $sTable where thread <>0 order by thread desc limit $nDisplay"; $nThreads = mysql_db_query($sDB, $sSQL,$nConnection); $nRows = mysql_num_rows ( $nThreads ); } } $topics = ""; if ( $nRows > 0 ){ $a=1; $thread = mysql_result($nThreads, 0, "thread"); $topics = "$thread"; While($a<$nRows){ $thread = mysql_result($nThreads, $a, "thread"); $topics = $topics.",$thread"; $a++; } } if($topics!=""){ $sSQL = "Select id,topic,name,datestamp,thread from $sTable where thread in ($topics) order by thread desc, id"; } else{ $sSQL = "Select id,topic,name,datestamp,thread from $sTable"; } echo ""; ?>0){ $nRows = mysql_num_rows($nTopics); $nav = "
\n
\n
\n\n"; if($RestrictedPosting==0){ $nav = $nav." $lStartTopic "; } if($nRows>0){ //Initialize navigation $sSQL = "Select max(thread) as max, min(thread) as min from $sTable where thread in ($topics)"; $nMaxMin = mysql_db_query ( $sDB, $sSQL, $nConnection ); $obj = mysql_fetch_object($nMaxMin); $HiOnPage = $obj->max; $LowOnPage = $obj->min; $sSQL = "Select max(thread) as max, min(thread) as min from $sTable"; $nMaxMin = mysql_db_query ( $sDB, $sSQL, $nConnection ); $obj = mysql_fetch_object($nMaxMin); $HiThread = $obj->max; $LowThread = $obj->min; if($HiThread>$HiOnPage){ if(strstr($nav,$lStartTopic)!=""){ $nav = $nav."|"; } $nav = $nav." $lGoToTop | $lNewer "; } if($LowThread<$LowOnPage){ if(strstr($nav,$lStartTopic)!="" || strstr($nav,$lGoToTop)!=""){ $nav = $nav."|"; } $nav = $nav." $lOlder "; } } $nav = $nav."\n
\n
\n
\n

\n"; echo $nav; echo "\n"; if($nRows>0){ include "threads.inc"; echo $nav; echo "\n"; } else{ echo "

$lForumEmpty

\n"; } } else{ ?>