I am showing user record of how many forms he/she has accepted and for that purpose I am using pagination in php. Data is fetched from oracle database and shown in the table. I am using pagination, but when I go on next page it shows the previous record's new records are not shown.
<table>
<tbody>
<?php
include('connect.php');
$user_name = $_SESSION['username'];
$sql = oci_parse($conn,"select * from userM where user_name = '$user_name'");
$result = oci_execute($sql);
while(($row = oci_fetch_array($sql,OCI_BOTH)) != false ){
$approvedBy = $row[1];
}
if(!isset($_GET['page'])){
$_GET['page'] = 0;
}else{
// Convert the page number to an integer
$_GET['page'] = (int)$_GET['page'];
}
$varPage = $_GET['page'];
if($varPage == "" || $varPage == "1"){
$page1 = 0;
}else{
$page1 = ($varPage*6)-6;
}
$approvedBy = strtoupper($approvedBy);
$sql = oci_parse($conn,"SELECT * FROM formC where UPPER(approvedBy) = '$approvedBy' AND rownum < 7");
oci_execute($sql);
while(($row = oci_fetch_array($sql,OCI_BOTH)) != false ) {
$accountingNo = $row[0];
?>
<tr>
<td style="color:black"><?php echo $row[0] ?></td>
<td style="color:black"><?php echo $row[1] ?></td>
<td style="color:black"><?php echo $row[2] ?></td>
<td style="color:black"><?php echo $row[3]?></td>
<td style="color:black"><?php echo $row[4] ?></td>
<td style="color:black"><?php echo $row[7] ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
$sql1 = oci_parse($conn,"SELECT * FROM formC where UPPER(approvedBy) = '$approvedBy'");
oci_execute($sql1);
$count = oci_fetch_all($sql1,$abc);
$a=$count/6;
$a = ceil($a);
for($b=1;$b<=$a;$b++){
?>
<a href="approvedList.php?page=<?php echo $b?>" style="text-decoration;align:center: none;" class="btn btn-success "><?php echo $b." "; ?></a>
<?php
}
oci_close($conn);
?>
</div>