Re: lost link to pgsql thru PHP pages
| From: | Steve Brett | Date: | Mon, 16 Jul 2001 12:22:26 +0000 |
| Subject: | Re: lost link to pgsql thru PHP pages | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-10443@lists.php.net to get a copy of this message | ||
ther eis no problem connecting to the db every page unless you have problems
that are discussed at postgresql.org regarding persistant connections.
i used them had problems with zillions of postmasters starting.
use the following and include it in the pages that need db access.
<?php
if (!$link)
{
$link = pg_connect("dbname=XXXX port=5432 user=postgres password=XXXX");
}
passing the link in the url is clumsy and unnecessary.
<substitute pg_pconnect if you need it>
Steve
"Cornelia Boenigk" <poppcorn@cornelia-boenigk.de> wrote in message
news:002901c10d88$9b546fc0$0100007f@localhost...
> Hi Albert
>
> > Hi, i have tried in any mode to pass the link from 1st page where i
> make
> > the connect
> > and the second where the connect is lost.
>
> Not the connection is lost but the variable $link.
> You use pg_pconnect which establishes a persistent connection. This
> connection is not automatically closed, when the page is left.
>
> You have to pass the variable to the next page, for example with the
> url:
>
> <a href="test2.php?link=$link">Test2</a>
>
> Hope it helps
> Conni
>
>