Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Spliting results into pages

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

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:
    http://www.example.com/?a=findspikes&brand=1&maxprice=&minSize=35.0&maxSize=49.0&page=1

    http://www.example.com/a=findspikes&brand=1&maxprice=55&minSize=37.0&maxSize=43.0&page=1

    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!
tnrh1
New php-forum User
New php-forum User
 
Posts: 4
Joined: Wed Jun 12, 2013 6:52 am

Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron