Location: PHPKode > projects > Athena Research Assistant > athena-dev-0.1pre-alpha/includes/showPAGEnumbers.inc.php
<?php
//THIS FUNCTION WILL ASSEMBLE PAGE NUMBERS ON TOP OF THE PAGE
//$LIMIT = GLOBAL LIMIT SET IN CONFIG/CONFIG.PHP
//$PAGE = PAGE NUMBER SET BY $_GET["page"]
//$userGROUPID = USER GROUP ID BASED IN THE $_SESSION["userGROUPID"]
//$db = WHICH DATABASE
//$where = WHICH TABLE WILL BE CHECKED AGAINST THE $THISuserGROUPID
//$action = value for the $act variable which decides which module is used by pages/main.php

function showPAGEnumbers($LIMIT, $page, $userGROUPID, $db, $where, $action){

//BEGIN GET TOTAL ROWS, SHOW PAGE NUMBERS
		
		if ($_SESSION["ADMINISTRATE"] == 1){
			$Tquery = mysql_query("SELECT * FROM $db");
			if (!$Tquery){
				echo("<p class=\"red\">Tquery failed</p>");
				echo(mysql_error());
			exit();
			}
		}
		else{
			$Tquery = mysql_query("SELECT * FROM $db WHERE $where=$userGROUPID");
			if (!$Tquery){
				echo("<p class=\"red\">Tquery failed</p>");
				echo(mysql_error());
				exit();
			}
		}
		
		$totalRESRCfound = mysql_num_rows($Tquery);
		
		$totalPAGES = round(($totalRESRCfound / $LIMIT) + 0.5);
		
		echo("<tr>");
			echo("<td height=\"15\" valign=\"middle\" align=\"center\" bgcolor=\"#DCDCDC\">");
			//echo("Found: " . $totalRESRCfound . " resources. Total pages=" . $totalPAGES);
			//echo("<br>");
			
			for ($i = 1; $i <= $totalPAGES; $i++){
				if ($i == $page){
					echo("<b>[</b>" . $i . "<b>]</b>");
					echo(" ");
				}
				else{
					echo("<a href=\"main.php?menu=viewresrc&act=" . $action . "&valign=top&page=" . $i . "\">" . $i . "</a>");
					echo(" ");
				}
			}
			
			echo("</td>");
		echo("</tr>");
		
		echo("<tr>");
			echo("<td valign=\"top\" height=\"10\">");
			echo("</td>");
		echo("</tr>");
		//END GET TOTAL ROWS, SHOW PAGE NUMBERS
}
?>
Return current item: Athena Research Assistant