I am using Dreamweaver mx 2004, php and MYSQL:
When I insert recordet Navigation bar in dreamweaver the 'Next' and 'Previous' Text do not seem to work with my recordset.
The following PHP Code exists for the 'Previous' Text (for recordset 'Test2')
<?php if ($pageNum_Test2 > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_Test2=%d%s", $currentPage, max(0, $pageNum_Test2 - 1), $queryString_Test2); ?>">Previous</a>
<?php } // Show if not first page ?>
The following code exists for the 'Next' Text for the same recordset:
<?php if ($pageNum_Test2 < $totalPages_Test2) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_Test2=%d%s", $currentPage, min($totalPages_Test2, $pageNum_Test2 + 1), $queryString_Test2); ?>">Next</a>
<?php } // Show if not last page ?>
This occurs on a master page that has been fed from a submit form (method Post). The odd thing is is that this code works for a recordset on another page that is fed from a URL Parameter!
Does anybody know what is wrong with the code?
Pagination Problem
Moderator: General Moderators
- Buddha443556
- Forum Regular
- Posts: 873
- Joined: Fri Mar 19, 2004 1:51 pm
Pagination is very tricky I think. I had the exact same problem but I managed to get it to work. Have a look at my topic:
viewtopic.php?t=22008&highlight=
viewtopic.php?t=22008&highlight=
I definitely have more than one page in the recordset.
I have reviewed the tutorial on your link before and it seems rather wieldy for my purposes. I've done all the MYSQL Stuff in my Dreamweaver table and just want to insert a small piece of code underneath it to paginate. This is indeed a frustrating problem !
It seems odd that the code works when the page is 'fed' from a URL Parameter but does not work when fed from a submit form??
Comments please......
I have reviewed the tutorial on your link before and it seems rather wieldy for my purposes. I've done all the MYSQL Stuff in my Dreamweaver table and just want to insert a small piece of code underneath it to paginate. This is indeed a frustrating problem !
It seems odd that the code works when the page is 'fed' from a URL Parameter but does not work when fed from a submit form??
Comments please......
If your script assigns variables (current page/record as example) from the URI using the superglobal $_GET, a submit form will not help. A form uses $_POST so that might be the issue.royalblue wrote:It seems odd that the code works when the page is 'fed' from a URL Parameter but does not work when fed from a submit form??
Comments please......
Try to look up further in the script to see what happens, and add some echo $var; on various of places to see what happens within the script.
If everything else fails, post some code on how the variables are assigned their values from the URI. (And use PHP tags.) Good luck.
Edit:
I'm above blatantly assuming that you ARE indeed using $_GET/$_POST with register_globals off and so on as the majority of users.