Re: Loss of connection handle object
| From: | Simon Garner | Date: | Fri, 02 Mar 2001 00:45:03 +0000 |
| Subject: | Re: Loss of connection handle object | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-42260@lists.php.net to get a copy of this message | ||
From: "Andrew Halliday" <andrew@recalldesign.com>
> Okay - Im writing an object to wrap a database.
> The key problem is this:
> - it declares a connection var as an object property
> - the open() function opens the connection to the database and stores
> the handle in $this->connection
> - the executeQuery() method complains about not having a valid handle,
> because by then, somehow, $this->connection==null!!!
>
> Any ideas?-i swear its just something stupid ive missed ...
>
> HELP!
>
> Thanx in advance,
> AndrewH
>
> -------------------------------------------------------------
> The code following this returns the following to the browser:
> -------------------------------------------------------------
> The connection in open() is :Resource id #1
> The connection in executeQuery() is :''
>
> Warning: Supplied argument is not a valid PostgreSQL link resource in
> /var/wwwroot/php/PostgreSQLDataSource.php on line 67
>
>
> -------------------------------------------------------------
>
What happens if you do:
<?php
$db = new PostgreSQLDataSource("host", "port", "user",
"pass", "db");
$db->open();
echo $db->connection;
?>
Cheers
Simon Garner