Execute($sql); // Figure out the total number of results in DB: $total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM idx_reslink where category_id=1"),0); // Figure out the total number of pages. Always round up using ceil() $lastpage = ceil($total_results / $max_results); global $pagination; $pagination .= "
Select a Page
"; if ($page == 1) { $pagination .= " FIRST PREV "; } else { $pagination .= " FIRST "; $prevpage = $page-1; $pagination .= " PREV "; } $pagination .= " ( Page $page of $lastpage ) "; if ($page == $lastpage) { $pagination .= " NEXT LAST "; } else { $nextpage = $page+1; $pagination .= " NEXT "; $pagination .= " LAST "; } $total .= $total_results; $test = ''; for($i = 0;$i < $result->RecordCount(); $i++) { $date = $result->Fields("date"); $description = $result->Fields("description"); $title = $result->Fields("title"); $test .= '
Date Description Date Added
'.$title.' '.$description.' '.$date.'
'; $result->movenext(); } $files = $test; $paginate = $total; DisplayTemplate($theme_path . "cp/cprm1.html", "\$files,\$paginate,\$error_msg"); } /*=================================================== main ===================================================*/ include "../application.php"; RunPreFilter(__FILE__); ShowMyFiles(); RunPostFilter(__FILE__); ?>