Well I've never actually made two calls to connect in one script, but what
happens on the second one is PHP notices you already have a connection open,
and instead of establishing a new one it just returns the current connection
ID.
On your first call to pconnect, PHP looks for any persistant connections
that are available to it.
If it finds one it returns the ID of it to your script, which is really
fast. But if it doesn't find a connection, it creates a new one and returns
that.
Two connects or two pconnects in the same script will work the exact same
way, but one connect and one pconnect won't do exactly what you might think
it would.
--
Plutarck
Should be working on something...
...but forgot what it was.
""Picard, Cyril"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
So :
<?php
$conn = pg_pConnect("dbname=foo");
$res = pg_Exec($conn, "SELECT * FROM BAR");
$conn = pg_pConnect("dbname=foo"); // Here PHP/database will
automagically find a persistent connection and reuse it ?
$res = pg_Exec($conn,"SELECT * FROM XYZ");
?>
Is it what you mean ?
PS : I understand that my code here is not very usefull ;-)
> -----Message d'origine-----
> De: Plutarck [SMTP:[EMAIL PROTECTED]]
> Date: mercredi 18 avril 2001 15:57
> À: [EMAIL PROTECTED]
> Objet: Re: [PHP] Persistent connection & many scripts ?
>
> Nope, you don't need to save the ID. PHP/database does the work of
> remembering what the ID of your persistant connection is.
>
>
> --
> Plutarck
> Should be working on something...
> ...but forgot what it was.
>
>
> ""Picard, Cyril"" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> hummm... I don't know how to use pg_pconnect()... It returns a connection
> ID, isn't it ? And I have to use this connection ID later ?
> I would like to reuse this connection ID to another script... and the
> problem is here :(
>
> I feel that I ignore something so important that I'm stopped and so
> trivial
> that you do not think about it !
>
> > -----Message d'origine-----
> > De: Christian Reiniger [SMTP:[EMAIL PROTECTED]]
> > Date: mercredi 18 avril 2001 13:40
> > À: [EMAIL PROTECTED]
> > Objet: Re: [PHP] Persistent connection & many scripts ?
> >
> > On Tuesday 17 April 2001 16:28, you wrote:
> > > Yes... I'm not familiar with sessions. This should be like this ? :
> > >
> > > In connect.php :
> > > <?php
> > > session_start();
> > > $connect = pg_pConnect("blablabla");
> > > session_register("connect");
> > > <A HREF="query.php?<?=SID"?>clique ici</?>
> > > ?>
> >
> > Simply using pg_pconnect() (without saving the connection ID) should be
> > just as fast and more failproof
> >
> > --
> > Christian Reiniger
> > LGDC Webmaster (http://sunsite.dk/lgdc/)
> >
> > AAAAA - American Association Against Acronym Abuse
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]