Spliting results into pages
Posted: Sun Nov 17, 2013 12:36 pm
Hello everyone.
I have a page that filters products by character such as size,price etc..
I would like to split the results into pages 1,2,3 and so on.
I tried to do that but I failed, so I need you guys for that:
I have a page that filters products by character such as size,price etc..
I would like to split the results into pages 1,2,3 and so on.
I tried to do that but I failed, so I need you guys for that:
- First of all I need to know how many results I have to calculate the amount of pages and that's a problem since I limit the query to 20 results.
The solution I'm using is just sending another query without a limit and use the "mysql_num_rows" - if you have more efficient way to do that I would like to know.
- In this stage we know how many results I have, so I will probably run a loop to print all the pages (results/results_per_page). Now the problem is what would be the href value? I will show you few example of possible URL's before I click the next page button:
I need somehow to change the page=1 to page=(new value) and refresh the page.