Spliting results into pages

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 4
Joined: Wed Jun 12, 2013 6:52 am

Spliting results into pages

Postby tnrh1 » Sun Nov 17, 2013 2:49 am

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.
    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.

As you see I'm struggling to solve it, any help will be very appreciated!

Return to “PHP coding => General”

Who is online

Users browsing this forum: Bing [Bot] and 6 guests