Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $limit = 2;
- if (isset($_GET["page"]))
- {
- $page = $_GET["page"];
- } else
- {
- $page=1;
- };
- $start_from = ($page-1) * $limit;
- $sql = "SELECT * FROM album_catagories ORDER BY id DESC LIMIT $start_from, $limit";
- $rs_result = mysqli_query($connection, $sql);
- ?>
- <div class="full-gallery">
- <h3>Gallery</h3>
- <div class="row">
- <div class="content">
- <?php
- while($image = mysqli_fetch_assoc($rs_result))
- {
- echo '<div class="album_holder">
- <img id="myImg" src ="includes/uploads/images/gallery/'.$image['coverimage'].'" class="gallery-image">
- <p>'.$image['title'].'</p>
- <a id="purple-button" href="viewalbum.php?album='.$image['id'].'">View Album</a>
- </div>';
- }
- ?>
- </div>
- </div>
- <div class="pag-menu">
- <?php
- $sql = "SELECT COUNT(id) FROM album_catagories";
- $rs_result = mysqli_query($connection, $sql);
- $row = mysqli_fetch_row($rs_result);
- $total_records = $row[0];
- $total_pages = ceil($total_records / $limit);
- $pagLink = "<nav><ul class='pagination'>";
- for ($i=1; $i<=$total_pages; $i++) {
- $pagLink .= "<li><a href='gallery.php?page=".$i."'>".$i."</a></li>";
- };
- echo $pagLink . "</ul></nav>";
- ?>
- </div>
- </div>
- <?php include('footer.php'); ?>
Add Comment
Please, Sign In to add comment