如何将url变量传递给php分页中的下一页

我试图通过链接从URL获取值

例如$ id = 5;

<a href="https://stackoverflow.com/questions/31638907/how-to-pass-url-variable-to-next-pages-in-php-pagination/ifsc-bank.php?id=">link 1 

我有50个左右的链接列表

 link 1 link 2 link 3 . . link 50 

单击链接时,它将路由到ifsc-bank.php,并使用ifsc-bank.php中的$ _GET获取值

 $id=$_GET['id']; $query = "SELECT * FROM distdb WHERE BANK_ID = '$id'"; 

在输出中

  1 record 2 record2 3 record3 `First 1 2 3 Next` is my pagination 

当我点击1它的罚款显示相关记录id = $ id但点击2它没有显示任何记录。

我不明白为什么filter在其余页面中不起作用

听到的是我的代码

 paging($query,$records_per_page); $paginate->dataview($newquery); $paginate->paginglink($query,$records_per_page); ?> 

分页

 db = $dbh; } public function dataview($query) { $stmt = $this->db->prepare($query); $stmt->execute(); if($stmt->rowCount()>0) { while($row=$stmt->fetch(PDO::FETCH_ASSOC)) { $bank = $row['BANK']; $ifsc = $row['IFSC']; $branch= $row['BRANCH']; $micr = $row['MICR_CODE']; $address = $row['ADDRESS']; $contact = $row['CONTACT']; $city = $row['CITY']; $district = $row['DISTRICT']; $state = $row['STATE']; $bankcode=$row['IFSC']; $brcode = substr($bankcode, -6); ?> 
IFSC:
MICR:
Branch Code:

City :
District :
State:
Nothing here... db->prepare($query); $stmt->execute(); $total_no_of_records = $stmt->rowCount(); if($total_no_of_records > 0) { ?>
<?php $total_no_of_pages=ceil($total_no_of_records/$records_per_page); $current_page=1; if(isset($_GET["page_no"])) { $current_page=$_GET["page_no"]; } if($current_page!=1) { $previous =$current_page-1; echo "First  "; echo "Previous  "; } $x=""; for($i=1;$i<=$total_no_of_pages;$i++) { if($i==$current_page) { $x.= "".$i."  "; } elseif ($i>5 && $i!=$total_no_of_pages) { $x.= " "; } else { $x.= "".$i."  "; } } echo $x; if($current_page!=$total_no_of_pages) { $next=$current_page+1; echo "Next  "; echo "Last  "; } ?>

得到答案我需要在Html开始之前放置代码