denewey Posted July 18, 2009 Share Posted July 18, 2009 I have a php database search engine that works great, only thing is all results display on one page. I'm trying to figure out a simple handling for breaking it down 20 results to a page without passing the db query results from page to page. Is there a way to formulate a sql query so it gives me the first 20 results, then the next 20 results, etc.? Or is there some other simple method. the only options I'm looking at right now are: 1. re-execute the sql query on each page and only display the results desired (i.e. if you want results 21 - 40 loop through the first 20 but don't display them... OR 2. Save all results in an array and pass it page to page and display the desired results from that array. I can't help but think there is a simpler method. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/166424-solved-display-of-results-of-a-db-search/ Share on other sites More sharing options...
GingerRobot Posted July 18, 2009 Share Posted July 18, 2009 You want option one and a technique called pagination. See this tutorial: http://www.phpfreaks.com/tutorial/basic-pagination Quote Link to comment https://forums.phpfreaks.com/topic/166424-solved-display-of-results-of-a-db-search/#findComment-877631 Share on other sites More sharing options...
denewey Posted July 18, 2009 Author Share Posted July 18, 2009 Thank You, -denewey Quote Link to comment https://forums.phpfreaks.com/topic/166424-solved-display-of-results-of-a-db-search/#findComment-877707 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.