Re: Loss of connection handle object

From: Date: Fri, 02 Mar 2001 01:14:43 +0000
Subject: Re: Loss of connection handle object
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-42265@lists.php.net to get a copy of this message
> <?php > $db = new PostgreSQLDataSource("host", "port", "user", > "pass", "db"); > $db->open(); > > echo $db->connection; > ?> returns : Resource id #1 ... which is what would be expected ... The wierd thing is the result i get from my test script: --------------------------------- $manualNameTest = new AbstractDataSourceManager("PostgreSQLDataSource","","","wwwuser","","rp2"); $result = $manualNameTest->executeQuery("select * from requirements;"); $db = new PostgreSQLDataSource('','','wwwuser','','rp2'); $db->open(); echo $db->connection."<BR>"; echo $db->executeQuery("select * from requirements;"); ------------------------------------- returns: ------------------------------------ The connection in open() is :Resource id #1 connection in executeQuery() is :'' Warning: Supplied argument is not a valid PostgreSQL link resource in /var/wwwroot/php/PostgreSQLDataSource.php on line 67 The connection in open() is :Resource id #1 Resource id #1 The connection in executeQuery() is :'Resource id #1' Warning: 1 is not a valid PostgreSQL link resource in /var/wwwroot/php/PostgreSQLDataSource.php on line 67 Object ------------------------------ WHAT THE HELL IS GOING ON ?!?!?!?! AARGH! AndrewH ----- Original Message ----- From: "Simon Garner" <sgarner@expio.co.nz> To: "Andrew Halliday" <andrew@recalldesign.com>; <php-general@lists.php.net> Sent: Friday, March 02, 2001 11:15 AM Subject: Re: [PHP] Loss of connection handle object > 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 >

« previous php.general (#42265) next »