I have a file where I am showing two different reports. So these two different reports needs two different pagination scripts. I have done this. Pagination is working fine. But i have some issue. 1-When I clicks on 3rd page of 1st report it goes on 3rd page. But when I click on any page of second report the first report again comes to 1st page and vice versa. I am setting different variables of limit, offset, no of records, no of pages for both scripts. Here is the script for first script
$limit1=10; //nor is method that return total number of rows $nor1=nor("select count(*) as num from order_details where artist_id=".$_SESSION["sess_artistid"]); if( isset($_GET['pn1']) && $_GET['pn1']-0>0) $pn1=$_GET['pn1']; else $pn1=1; $nop1=ceil($nor1 / $limit1); if($pn1>$nop1) $pn1=1; $offset1=($pn1-1) * $limit1;
then I query to table and shows record. and here I am showing pagination for first script
for($i=1;$i<=$nop1;$i++) { if($i==$_GET['pn1']) echo('<a style="font-weight:bold;">'.$i.'</a>'); else echo('<a href="'.$_SERVER['PHP_SELF'].'?pn1='.$i.'">'.$i.'</a>'); }
Now for second report I am using the following code snipt
$limit=7; $nor=nor("select count(*) as num from order_details where product_id in(".implode(',',$products).") and artist_id in(".implode(',',$vendors).")"); if( isset($_GET['pn']) && $_GET['pn']-0>0) $pn=$_GET['pn']; else $pn=1; $nop=ceil($nor / $limit); if($pn>$nop) $pn=1; $offset=($pn-1) * $limit;
Then again query to table to show record and here showing pagination for second report
for($i=1;$i<=$nop;$i++) { if($i==$_GET['pn']) echo('<a style="font-weight:bold;">'.$i.'</a>'); else echo('<a href="'.$_SERVER['PHP_SELF'].'?pn='.$i.'">'.$i.'</a>'); }
As for as I am understanding, When any of the other report is clicked it sets the first report pn=1 that's why it goes to first page again. But not understanding how to handle this?