after searching large amount of data and calculating the relevancy of each result i now have a comlete ordered list of results.
the user asked to view the first page of the results which contain 20 results.
that's no problem, but the next pages are.
1st page - 1 to 20
2nd page - 21 - 40
3rd page - 41 - 60
...
How do i implament paging on my results? files? temporary indexed tables?
some better idea?
realy need a lot of help with this, so thank you very very much
searching large data and paging
Moderator: General Moderators
- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
There are quite a few tutorials re: pagination around the web, but a quick a dirty way to return the rows as you describe is by using LIMIT in the SELECT statement.
This will mean each time someone goes to the 'Next Page >>' you will execute the search again, but will only return the results that correspond to that page (records 21-40 for example).
Links for reference:
MySQL SELECT statement: http://dev.mysql.com/doc/mysql/en/SELECT.html
Code: Select all
mysql> SELECT * FROM table LIMIT 20,40; # Retrieve rows 21-40Links for reference:
MySQL SELECT statement: http://dev.mysql.com/doc/mysql/en/SELECT.html