Page 1 of 1

Spliting results into pages

Posted: Sun Nov 17, 2013 12:36 pm
by tnrh1
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:
  • 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.
As you see I'm struggling to solve it, any help will be very appreciated!

Re: Spliting results into pages

Posted: Sun Nov 17, 2013 3:24 pm
by Celauran
tnrh1 wrote: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.
SELECT COUNT

Re: Spliting results into pages

Posted: Mon Nov 18, 2013 5:46 am
by tnrh1
Thanks!
What about the second part?

Re: Spliting results into pages

Posted: Mon Nov 18, 2013 6:37 am
by Celauran
You've already got the links set up with all the necessary query string parameters. Just use a $page variable.

example.com/whatever.php?a=foo&b=bar&page=$page