1,2,3,4,5 etc next page 6,7,8,9,10 and so on
Hi
I want3d to know how do I achieve this.
I have a php pagination and it shows everything fine and works nicely but it is missing one thing and that is the feature to continue from last number of previous page. lets say my page shows 10 users and it gives a number before each name like below:
1: John
2: Michael
3: Shafiq
4: Hedar
5: Josh
and then you click on page 2 and it should start from 6,7,8,9,10 but instead it counts back from 1,2,3,4,5. If someone could help me out here. Thats would be nice. Here is the pagination script.
Code:
$entries_per_page = "5";
if(isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = 1;
}
$total_pages = ceil($count / $entries_per_page);
$offset = ($page - 1) * $entries_per_page;
$i = -1;
for($i = 1; $i <= $total_pages; $i++) {
echo "<a href=\"page$i\">$i</a> - ";
}
$qphoto = "SELECT * FROM `jhjkhjk` WHERE ft_id = '$ft_id' ORDER BY `pic_id` DESC LIMIT $offset, $entries_per_page";
$rphoto = mysql_query($qphoto);
$w = 0;
if (!$rphoto){
die ("Could not query the database:<br />Houston! we have a problem here. ". mysql_error());
}
while ($p = mysql_fetch_array($rphoto, MYSQL_ASSOC)) {
$w++;
echo "$w: $p[name]";
}
The above code is juss snippet of my code. If any of you have any custom pagination that would do what I am trying to achieve then please let me know.
Thanks alot.