MortimerJazz Posted December 30, 2006 Share Posted December 30, 2006 Just a quick question ...When running a query through a database, I may well end up getting 20 or 30 matches displayed on the screen. While this isn't exactly a problem, I think it would look better if I was able to split that up so that 10 matches were displayed on three different pages with links at the bottom of each page for a user to click through to see the next set of results.Can someone explain the best way to go about this please?Thanks Link to comment https://forums.phpfreaks.com/topic/32300-splitting-a-search-result-over-multiple-pages/ Share on other sites More sharing options...
Kairu Posted December 30, 2006 Share Posted December 30, 2006 I think what you want is to add "LIMIT [number to start at] , [number to show in total]" to the end of your mysql_query.[Number to start at] is the number you want the database to start returning values. Say you have 30 results normally, it would start showing from this point in the found matches.[Number to show] is the number of rows to return. In your case you want it to be 10.So you would want to add "LIMIT 0 , 10" for the first page. "LIMIT 9 , 10" for the second. "LIMIT 19 , 10" for the third and so on. Link to comment https://forums.phpfreaks.com/topic/32300-splitting-a-search-result-over-multiple-pages/#findComment-149930 Share on other sites More sharing options...
MortimerJazz Posted December 30, 2006 Author Share Posted December 30, 2006 Thanks for the reply Kairu.How would I set up the links at the bottom of the page though? Would I need to call the SQL query each time a link was clicked? And even if I had to, how would that get coded into a single HTML link? Link to comment https://forums.phpfreaks.com/topic/32300-splitting-a-search-result-over-multiple-pages/#findComment-149932 Share on other sites More sharing options...
Kairu Posted December 30, 2006 Share Posted December 30, 2006 I'm not sure at all if it's the easiest way, but you would need to refresh the page with new variables.Perhaps a hidden form? The submit button being the "Next Page" Button where it refreshes the page? I'm sorry I can't be of more help at the moment. My keyboard's software just went buggy (last few minutes) and I am using someone elses. (Running out of time, sry! ) Link to comment https://forums.phpfreaks.com/topic/32300-splitting-a-search-result-over-multiple-pages/#findComment-149937 Share on other sites More sharing options...
dbo Posted December 30, 2006 Share Posted December 30, 2006 Do a google for 'php paging' should be able to find some tutorials for what you're looking for. Link to comment https://forums.phpfreaks.com/topic/32300-splitting-a-search-result-over-multiple-pages/#findComment-150083 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.