I understand your question but I can't see any problem with running the query for each page.
If you retrieve all records and then store them in some form of cache file it does away with the problem of constantly requerying the db but retrieving the results from the cache file will be slow, defying the point in not requerying.
The other suggestion from "gtibok" of using an array is not feasible because of the memory requirements. Fine if you only have a couple of people browsing at the same time, but with heavy loads you'll just kill your server.
You should query the db each time. It is much quicker than using a cache file. You are not querying a huge number of records. So as long as your table indexes are efficient you'll have no problems. The db server is the most powerful tool you have - so use it to your advantage.
The only other possible option would be to use temporary heap tables, but it would not be appropriate for this.
Hope this make sense 😉