Re: Connection to postgresql DB used by 2 scripts ?
| From: | Johannes Janson | Date: | Wed, 18 Apr 2001 10:42:19 +0000 |
| Subject: | Re: Connection to postgresql DB used by 2 scripts ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-49172@lists.php.net to get a copy of this message | ||
Hi,
put: include("connect.php"); at the beginning of query.php.
Johannes
""Picard, Cyril"" <cyril.picard@eads-dsn.com> schrieb im Newsbeitrag
news:B5CDCF382265D311BF33009027A8FE9401E6F3BD@pmrmsg.edsn.com...
> 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 !
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>