Evening all,
Little help if you don't mind.
I'm pulling variables from a MySql DB and displaying them in a table. Easy. I've then got 2 drop down fields for sorting, each with their own submit button going via $_GET, (doesn't need to be secure). One filters the results and the other sorts them by date.
I can filter the results then sort them by date by including a hidden field in the form that gets the location variable if it exists and passing it along again if the date submit button is pressed.
All ok.
Now I want to implement pagination. Which I managed. Fairly standard I think, counts the total rows, works out which page we should be on, adjusts the MYSql query accordingly.
But how the hell do I get the 2 to work together? I can sort & filter the first page but after that it forgets, (obviously).Thought about using sessions, but seems overly complicated, and couldn't think of a way to implement them satisfactorily.
I guess the answer is to have it so that when the filter and sort forms are submitted it grabs the variables from the $_GET and uses them to make the new pagination links, but for some reason I seem to be struggling and getting bogged down in IF statements.
If anybody could link to a good tutorial, post up some sample code or tell me where i'm going wrong I'd really appreciate it.
Thanks
Little help if you don't mind.
I'm pulling variables from a MySql DB and displaying them in a table. Easy. I've then got 2 drop down fields for sorting, each with their own submit button going via $_GET, (doesn't need to be secure). One filters the results and the other sorts them by date.
I can filter the results then sort them by date by including a hidden field in the form that gets the location variable if it exists and passing it along again if the date submit button is pressed.
All ok.
Now I want to implement pagination. Which I managed. Fairly standard I think, counts the total rows, works out which page we should be on, adjusts the MYSql query accordingly.
But how the hell do I get the 2 to work together? I can sort & filter the first page but after that it forgets, (obviously).Thought about using sessions, but seems overly complicated, and couldn't think of a way to implement them satisfactorily.
I guess the answer is to have it so that when the filter and sort forms are submitted it grabs the variables from the $_GET and uses them to make the new pagination links, but for some reason I seem to be struggling and getting bogged down in IF statements.
If anybody could link to a good tutorial, post up some sample code or tell me where i'm going wrong I'd really appreciate it.
Thanks