RE: [PHP] Help w/pg_connect, pg_open.
| From: | Dave VanAuken | Date: | Wed, 13 Dec 2000 03:08:13 +0000 |
| Subject: | RE: [PHP] Help w/pg_connect, pg_open. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-30010@lists.php.net to get a copy of this message | ||
I don't understabnd the steps you are going through... here is some basic
code, see if this helps you. if not, try posting csome actual code so we
can comment on it. (this is older pg code)
#assuming you replace the following $DB items with actual values or assign
the variables
$database=pg_connect("$DBHost","$DBPort","$DBOpt","$DBTTY","$DBName");
$query="my sql select insert or whatever query";
$result=pg_exec($database,$query);
#do your usage of result in here
#if you need to call the same database with another query just exec another
query
$query="my sql select insert or whatever query";
$result=pg_exec($database,$query);
#do your usage of result in here
#if you need to call on another database, just assign another database
identifier
$database2=pg_connect("$DBHost","$DBPort","$DBOpt","$DBTTY","$DBName");
$query="my sql select insert or whatever query";
$result=pg_exec($database2,$query);
#do your usage of result in here
There is no need to close the database connection, it will close at the
completion of the script (unless you use pConnect)
if this isn't what you are referring to, post some of the code you are
using. perhaps you are running into function problem or something.
Dave
-----Original Message-----
From: Soma Interesting [mailto:dfunct@telus.net]
Sent: Tuesday, December 12, 2000 9:17 PM
To: php-general@lists.php.net
Subject: [PHP] Help w/pg_connect, pg_open.
Whenever I attempt to open and close more than one connection to pgsql in a
series I get an error from PHP. This is within a single php script. The
error:
Warning: 1 is not a valid PostgreSQL link resource
OPEN connection - assign $connection
USE connection - use $connection
CLOSE connection - unset($connection)
. . .
OPEN connection - assign $connection
USE connection - use $connection
error $connection not a valid PostgreSQL link resource
if echo($connection); it will output "Resource id #1".
OK, so what am I doing wrong now?
- - - - - - -
- - - - -
WARNING: Some experts believe that use of any keyboard may cause serious
injury.
Consult Users Guide.
dfunct@telus.net
--
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