Connection to postgresql DB used by 2 scripts ?
| From: | Picard, Cyril | Date: | Wed, 18 Apr 2001 09:34:09 +0000 |
| Subject: | Connection to postgresql DB used by 2 scripts ? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-49166@lists.php.net to get a copy of this message | ||
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 !