Re: maybe Offtopic : PostgreSQL & PHP ?

From: Keith Wong <keith(at)e-magine(dot)com(dot)au>
To: "Picard, Cyril" <cyril(dot)picard(at)eads-dsn(dot)com>, "'pgsql'" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: maybe Offtopic : PostgreSQL & PHP ?
Date: 2001-04-18 12:35:09
Message-ID: 5.0.2.1.0.20010418223233.00a68170@mail.e-magine.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php pgsql-sql

Not quite sure how your code is organised...
but you could access the variable $conn by including "connect.php" into the
"query.php" script.
Otherwise, you will need to use persistent connections... which can be
achieved via pg_pconnect...
a persistent connection will instead of creating a new database connection
each time.. it will try to use
an existing connection that is no longer being used (persistent connections
do tend to have a lot of quirks tho)

Keith

At 11:33 AM 18/04/2001 +0200, Picard, Cyril wrote:
>Hi all, sorry for the maybe offtopic questions, but I did not get any answer
>from the PHP ML.
>
>I would like to query a postgresql db with the php language.
>Today I wrote a script (connectandquery.php) performing the following :
>- connect to the DB : $conn = pg_Connect("dbname = foo");
>- execute the query : $res = pg_Exec($conn,"SELECT * from BAR");
>
>
>But I would like to write this in two scripts :
>- connect.php : $conn = pg_Connect("dbname = foo");
>- query.php : $res = pg_Exec($conn,"SELECT * from BAR");
>
>but I don't know how to get the $conn variable (defined in connect.php) in
>the script query.php.
>
>Any idea is welcome !
>
>---------------------------(end of broadcast)---------------------------
>TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

In response to

Responses

Browse pgsql-php by date

  From Date Subject
Next Message Roberto Mello 2001-04-18 13:34:30 Re: maybe Offtopic : PostgreSQL & PHP ?
Previous Message Picard, Cyril 2001-04-18 09:33:20 maybe Offtopic : PostgreSQL & PHP ?

Browse pgsql-sql by date

  From Date Subject
Next Message Roberto Mello 2001-04-18 13:34:30 Re: maybe Offtopic : PostgreSQL & PHP ?
Previous Message Andy 2001-04-18 10:16:54 copy into serial field with auto_increment