From: Keith Wong <keith@e-magine.com.au>
To: Picard, Cyril <cyril.picard@eads-dsn.com>
To: 'pgsql' <pgsql-sql@postgresql.org>
Subject: Re: maybe Offtopic : PostgreSQL & PHP ?
Date: Wed, 18 Apr 2001 22:35:09 +1000
Message-ID: <5.0.2.1.0.20010418223233.00a68170@mail.e-magine.com.au> (raw)
In-Reply-To: <B5CDCF382265D311BF33009027A8FE9401E6F3BC@pmrmsg.edsn.com>
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@postgresql.org)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: keith@e-magine.com.au, cyril.picard@eads-dsn.com
Subject: Re: maybe Offtopic : PostgreSQL & PHP ?
In-Reply-To: <5.0.2.1.0.20010418223233.00a68170@mail.e-magine.com.au>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox