<html>
<head>
    <title>Pagination</title>
</head>
<body>
    <?php
        include'connection.php';
        include'time.php';
        
        $results_per_page=10;
        
        $quGetTxn="select * from recharge where Rechargedate='$date'";
        $reGetTxn=mysqli_query($con,$quGetTxn);
        $number_of_txn=mysqli_num_rows($reGetTxn);
        
        $number_of_page=ceil($number_of_txn/$results_per_page);
        
        // start copy from online page//
        //determine which page number visitor is currently on  
    if (!isset ($_GET['page']) ) {  
        $page = 1;  
    } else {  
        $page = $_GET['page'];  
    }  
  
    //determine the sql LIMIT starting number for the results on the displaying page  
    $page_first_result = ($page-1) * $results_per_page;  
    
    // end copy from online page//
        $query = "SELECT *FROM recharge where Rechargedate='$date' LIMIT " . $page_first_result . ',' . $results_per_page;
        //$query="select * from recharge limit".$page_first_result.','.$results_per_page;
        $result=mysqli_query($con,$query);
        while($row=mysqli_fetch_array($result))
        {
            echo $row['Id'].' '.$row['Amount'].'</br>';
        }
        
        
            //display the link of the pages in URL  
    for($page = 1; $page<= $number_of_page; $page++)
    {  
        echo '<a href = "pagination.php?page=' . $page . '">' . $page . ' </a>';  
    }  

    ?> 
</body>
</html>