0)) { // This variable is set to zero for the first page
$start = 0;
}
$eu = ($start -0);
$limit = 15; // No of records to be shown per page.
$this1 = $eu + $limit;
$back = $eu – $limit;
$next = $eu + $limit;
$count=0;
if((isset($sdept))and($sdept!=”All”)){
$r=mysql_query(“SELECT * FROM addressbook,address_in_groups,group_list WHERE (group_list.group_id = address_in_groups.group_id) and (address_in_groups.id=addressbook.id) and (firstname like ‘%$sname%’) and (group_list.group_id=$sdept) limit $eu, $limit”);
$squery=mysql_query(“SELECT * FROM addressbook,address_in_groups,group_list WHERE (group_list.group_id = address_in_groups.group_id) and (address_in_groups.id=addressbook.id) and (firstname like ‘%$sname%’) and (group_list.group_id=$sdept) “);
}
else
{
$r=mysql_query(“SELECT * FROM addressbook,address_in_groups,group_list WHERE (group_list.group_id = address_in_groups.group_id) and (address_in_groups.id=addressbook.id) and (firstname like ‘%$sname%’) limit $eu, $limit”);
$squery=mysql_query(“SELECT * FROM addressbook,address_in_groups,group_list WHERE (group_list.group_id = address_in_groups.group_id) and (address_in_groups.id=addressbook.id) and (firstname like ‘%$sname%’) “);
}
$nume = mysql_num_rows($squery);
while($row=mysql_fetch_array($r))
{
$title[$count]=$row[‘firstname’];
$group_name[$count]=$row[‘group_name’];
$phone[$count]=$row[‘home’];
$count++;
}
?>
Name / Designation
|
Department
|
Telephone |
15){
$p_f=$_GET[‘p_f’]; // To take care global variable if OFF
if(!($p_f > 0)) { // This variable is set to zero for the first page
$p_f = 0;
}
$p_fwd=$p_f+$p_limit;
$p_back=$p_f-$p_limit;
//////////// End of variables for advance paging ///////////////
/////////////// Start the buttom links with Prev and next link with page numbers /////////////////
echo ”
“; if($p_f<>0){print “PREV $p_limit“; } echo “ |
“; //// if our variable $back is equal to 0 or more then only we will display the link to move back //////// print “ “; if($back >=0 and ($back >=$p_f)) { print ““; } else { print ““; } //////////////// Let us display the page links at center. We will not display the current page as a link /////////// $cst=$eu+1; $cfl=$cst+15-1; if($cfl>=$nume) $cfl=$nume; echo “ |
Results $cst-$cfl of $nume“; echo “ |
“; ///////////// If we are not in the last page then Next link will be displayed. Here we check that ///// if($this1 < $nume and $this1 <($p_f+$p_limit)) { print “ “;} else{ print ““;} $totalrec=$nume%15; $netrec=$nume-$totalrec; print ““; echo “ |
“; echo “ |
“;
}
?>