Persistent database connection

General discussions related to php

Moderators: macek, egami, gesf

devendraC
New php-forum User
New php-forum User
Posts: 7
Joined: Tue Aug 19, 2003 1:57 am

Persistent database connection

Postby devendraC » Tue Aug 26, 2003 11:46 pm

Hi,
Could anyone tell me how to use persistent database connection in PHP, using Postgres database. Is any sample?

Please help
Regards
Devendra

devendraC
New php-forum User
New php-forum User
Posts: 7
Joined: Tue Aug 19, 2003 1:57 am

Postby devendraC » Wed Aug 27, 2003 5:25 am

Hi,
What I want:
1) Open database connection.
2) Fatch some rows.
3) If user clicks next button, Fetch next set of rows from previously opended record set(persisted)

Is it possible in PHP-PostgreSQL ?

Regards
Devendra

User avatar
swirlee
Moderator
Moderator
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Postby swirlee » Wed Aug 27, 2003 5:38 am

pg_pconnect() -- 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.

User avatar
tryton
New php-forum User
New php-forum User
Posts: 49
Joined: Wed Jul 09, 2003 8:25 am
Location: Joze
Contact:

Postby tryton » Wed Aug 27, 2003 5:45 am

There's a great tutorial at http://www.phpfreaks.com about pagination.


Return to “PHP General”

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest