QUESTION POSED ON: 27 December 2005 My question is regarding paging SQL Server data results. I am using PHP with SQL Server. For a specific search I have nearly 500 records. I am displaying 50 results per page and providing PREV and NEXT option for paging. In order to fetch the second set of results (for page 2), what I am doing is running the query again (fetching the whole 500 records) and just filtering the first 50 records inside the script and start displaying records from 50 to 100. I know this is not the best way to do it. Could you please suggest a better solution for this? Also, is it Ok to query the database for each page? At the same time, my query involves joins with 3 tables.
Please help me on this.
>
EXPERT RESPONSE
I am not familiar with PHP but look into the record set options. I know with the latest build of ADO.NET, many options are available to cache the record set and only traverse the record sets that are needed and then query SQL Server for the needed data.
Search and Browse the Expert Answer Center Search and browse more than 25,000 question and
answer pairs from more than 250 TechTarget industry experts.
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.