NETSYNC Posted October 22, 2010 Share Posted October 22, 2010 Hey all. I have a query that selects data from a datbase based on a criteria. Easy enough. But now I am growing and the amount displaying is too much. How can you, via php, have a queries result be displayed only so many at a time and auto create links that show the rest? Like if query returns 82 results, I want it to display 25 immediately and create 3 links at the bottom. The next link would show 26-50. The next 51-75. And the final 76-82. etc Example: $result = mysql_query("SELECT * FROM pay"); $num_rows = mysql_num_rows($result); while($row = mysql_fetch_array($result)) { echo $row['first_name']; echo $row['last_name']; echo $row['item_name']; echo $row['option_selection1']; echo $row['payment_date']; echo $row['stat']; } This is simple. But what happens when the results are 125? I want to limit it to displaying 25 at a time. Is the only way to manually create seperate pages and have each one show 1-25, then 26-50, etc? Or is there a way to have the script do it, itself? Any tutorials out there on this specifically? Hopefully I am making sense. Thanks! Link to comment https://forums.phpfreaks.com/topic/216535-display-query-results-only-25-at-a-time/ Share on other sites More sharing options...
Pikachu2000 Posted October 22, 2010 Share Posted October 22, 2010 What you're looking for is called pagination, and there's a tutorial on the main part of this site. >Clicky< Link to comment https://forums.phpfreaks.com/topic/216535-display-query-results-only-25-at-a-time/#findComment-1125082 Share on other sites More sharing options...
NETSYNC Posted October 22, 2010 Author Share Posted October 22, 2010 Exactly. Thank you very much! Link to comment https://forums.phpfreaks.com/topic/216535-display-query-results-only-25-at-a-time/#findComment-1125086 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.