shadiadiph Posted March 9, 2009 Share Posted March 9, 2009 I have been using the pagination from the tutorial in here problem is on one page I have two tables that both have te pagination on them and when I click on link two both tables jump to link 2 which variable in this do i need to change for this to work do i need to rename all the $totalpages or just $x i tried it once and it didn't work. $range = 3; if ($currentpage ==2) { $prevpage = $currentpage - 1; echo "<td> <a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage'>PREVIOUS</a> </td>"; } if ($currentpage > 2) { echo " <tr><td><a href='{$_SERVER['PHP_SELF']}?currentpage=1'>FIRST</a></td> "; $prevpage = $currentpage - 1; echo " <td><a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage'>PREVIOUS</a><td> "; } for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) { if (($x > 0) && ($x <= $totalpages)) { if ($x == $currentpage) { echo "<td class='sel'> [<b>$x</b>]</td> "; } else { echo " <td><a href='{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a></td> "; } } } if ($currentpage == $totalpages -1) { // echo forward link for lastpage echo "<td> <a href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages'>NEXT</a> </td>"; } else { if ($currentpage != $totalpages) { // get next page $nextpage = $currentpage + 1; // echo forward link for next page echo " <td><a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage'>NEXT</a></td> "; // echo forward link for lastpage echo " <td><a href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages'>LAST</a></td> "; } } Quote Link to comment https://forums.phpfreaks.com/topic/148570-solved-page-pagination-help/ Share on other sites More sharing options...
luna Posted March 12, 2009 Share Posted March 12, 2009 Hi, I building a photographic website and have a database in with the details want to paginate the results by category. I have run through the pagination tutorial and I think that I understand it. I have added the code to my page - see attached. And running it I get "Parse error: syntax error, unexpected $end in /home/outwell1/public_html/beta/photogalpag.php on line 330" Error message. - line 330 is the last line of the page </html> Can any one help please? Thanks [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/148570-solved-page-pagination-help/#findComment-783048 Share on other sites More sharing options...
sasa Posted March 12, 2009 Share Posted March 12, 2009 you didn't close for loop opened in line 290 Quote Link to comment https://forums.phpfreaks.com/topic/148570-solved-page-pagination-help/#findComment-783079 Share on other sites More sharing options...
shadiadiph Posted March 13, 2009 Author Share Posted March 13, 2009 sounds like you are missing a } maybe you have a loop still open Quote Link to comment https://forums.phpfreaks.com/topic/148570-solved-page-pagination-help/#findComment-783469 Share on other sites More sharing options...
luna Posted March 13, 2009 Share Posted March 13, 2009 Thanks all. I am new at this but should really of spotted it! A few other glitches but I now have it working I think. David Quote Link to comment https://forums.phpfreaks.com/topic/148570-solved-page-pagination-help/#findComment-783732 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.