Forum Moderators: coopster

Message Too Old, No Replies

paginating result for two queries

         

someone

11:27 pm on Feb 2, 2006 (gmt 0)

10+ Year Member



My page pagination works fine, but the code is just messy. Because I have two queries, one based on getting the ID number ($_GET['ID']) and one based on searching by keywords ($_POST['keyword']), I almost have duplicate codes for both.

For example,


if($start!= 0) {
if($browse) { //for $_GET query
echo 'Previous</a> ¦ ';
}
else { //for $_POST query
echo 'Previous</a> ¦ ';
}
}

I am not putting the full version of codes down as that would be too much. But hopefully, you'll get what I mean. I have to list "echo 'Previous</a>' twice because one's for the get query and the other's for the post query. So a lot of duplicate codes. How could I shorten the codes a bit?

coopster

8:16 pm on Feb 4, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I take it you must have a form on this page as well and in that form you have hidden form fields with the *previous* value stored? Well, if the user is not paging using the <a href> or $_GET method, then why worry about the pagination? Or am I missing something here?