Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $db_host = "localhost";
- $db_username = "root";
- $db_pass = "";
- $db_name = "final";
- $con= mysqli_connect("$db_host","$db_username","$db_pass") or die ("could not connect to mysql");
- mysqli_select_db($con, "final") or die ("no database");
- $pagination_sql = "SELECT * FROM `ongoing` WHERE approved='approve'";
- $run_pagination = mysqli_query($con, $pagination_sql);
- $count = mysqli_num_rows($run_pagination);
- $total_pages = ceil($count/$per_page);
- echo "<ul class='pagination'>";
- echo "<li class='page-item'><a class='page-link' href='ongoing.php?page=".($page-1)."' class='button'>
- <span aria-hidden='true'>«</span>
- <span class='sr-only'>Previous</span>
- </a></li>";
- for($i=1;$i<=$total_pages;$i++){
- echo'<li><a class="page-link" href="ongoing.php?page='.$i.'">'.$i.'</a></li>';
- };
- echo "<li class='page-item'><a class='page-link' href='ongoing.php?page=".($page+1)."' class='button'>
- <span aria-hidden='true'>»</span>
- <span class='sr-only'>Next</span>
- </a></li>";
- echo "</ul>";
- ?>
- $per_page = 10;
- if(isset($_GET['page'])){
- $page = $_GET['page'];
- }else{
- $page= 1;
- }
- $start_from = ($page-1) * $per_page;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement