Hey guys. I am trying to select a whole bunch of rows from a database and then have only 30 output per page. I was thinking of just putting an IF statement within while($row = mysql_fetch_array($result)) and then have an incrementing variable and stop outputting when its >30, but i know thats not very efficient as the server is still oputting everything.
You have to use limit command in your query to restrict the output. You can keep the number of records per page in a variable and ask the visitors to select that value, so they can select 10 records per page or 20 records per page or more.
All these techniques are used in php paging script here. You can see advanced version of the script where pages broken in groups.
You don't need to insert your code in multiple page , all you have to do is to use paging, so that all your information are displayed on the same page but only a chosen length , which we be replaced by another set each time the page load load.
« Reply to Displaying database query over multiple pages