Hey everyone, I have a MYSQLI statement that i would like to add pagination to. I would like to have it set to 5 per page, and not have a negative value if you are on page 1 (disables back link) Every tutorial i have been seeing allows for a negative back and i cannot figure it out. My code is as follows and I know that i have to introduce the Pagination before the while statement and it needs to finish after the while statement..
<?php
$query = "SELECT * FROM `blog_posts` ORDER BY postID DESC ";
$result = mysqli_query($bd, $query);
while ($row = mysqli_fetch_assoc($result)){
echo '<div>';
echo '<img src="../mini_logo.png" height="25" width="50">';
echo '<h3><a href="viewpost.php?id='.$row['postID'].'">'.$row['postTitle'].'</a></h3>';
echo '<p>Posted by '.$row['postBy']. ' on '.date('M jS Y H:i:s', strtotime($row['postDate'])).'</p>';
echo '<p>'.$row['postDesc'].'</p>';
echo '<p align="right"><a class="btn btn-primary btn-md active" role="button" href="viewpost.php?id='.$row['postID'].'">Read More <span class="glyphicon glyphicon-arrow-right"> </span></a></p>';
echo '</div><hr>';
}
?>
Any help would be awesome!