function getVer($cc) { while ($key = key($_GET)) { if ($key==$cc) {return 1;} next($_GET); } return 0; } $page_id=1; if (getVer("page")==1) {$page_id=$_GET['page'];} //$c_id=$_GET['object_id']; function getDBConnection () { include("_db.php"); //contains the given DB setup $db, $server, $user, $pass $conn = mysql_connect($server, $user, $pass); if (!$conn) { //echo "Connection to DB was not possible!"; end; } if (!mysql_select_db($db, $conn)) { //echo "No DB with that name seems to exist at the server!"; end; } return $conn; } //page count------------------ $rec_page=10; //Number of records per page $sql = "select count(*) from ptb_contact"; $conn = getDBConnection(); $results = mysql_query($sql, $conn); $row_c = mysql_fetch_array($results); $cnt=$row_c[0]; if ( $cnt%$rec_page== 0 ) {$total_pages=$cnt/$rec_page;} else {$total_pages= ($cnt-$cnt%$rec_page)/$rec_page+1;} //echo $total_pages; $pgx=""; if ($cnt>0) {$pgx=" Pages: ";} for ($i = 1; $i < $total_pages+1; $i++) { $pgx=$pgx.""; if ($i==$page_id ) {$pgx=$pgx."".$i." ";} else { $pgx=$pgx.$i." ";} } $pgx=$pgx.""; ?>