-- Open a persistent PostgreSQL connection.
Be sure to read the "see also" links on that page, too.
Of course, the short answer to what I think your question is is: No, once your PHP script is finished executing, all of its attached resources are freed. You're just going to have to repeat your query. It sounds like all you're after is pagination, which is dead simple. Just make the query on the first page return the first X results (using LIMIT), make the query on the second page (after you click Next) return X rows starting at X, the third page return X rows starting at 2X, and so on.