I would like to ask if how to do simple paging and pagination like GOOGLE.
should I use javascript?
should I use bootstrap?
This is my code for my pagination and I have 30 page buttons right now with 9 records per page
and all of them are present on the page.
$results_per_page = 9;
// find out the number of results stored in database
$result = mysqli_query($link, $query);
$number_of_results = mysqli_num_rows($result);
// determine number of total pages available
$number_of_pages = ceil($number_of_results/$results_per_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
$this_page_first_result = ($page-1)*$results_per_page;
// retrieve selected results from database and display them on page
$sql='SELECT * FROM policy LIMIT ' . $this_page_first_result . ',' . $results_per_page;
$result = mysqli_query($link, $sql);
// display the links to the pages
?>
<form method="post">
<?php
for ($page=1;$page<=$number_of_pages;$page++) {
?>
<input class="btn btn-success" type="submit" value="<?php echo $page;?>" name="page" >
<?php
}
?>
</form>
<?php
$page = 0;
?>
I want to hide other buttons while the 10 buttons are shown.
Thank you in advance ^_^