Re: Static Member Variables holding objects w/methods

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, August 16, 2006 9:13 am, Gabe wrote:
> I'm trying to use the following method of a class (DbConnector):
>
> public function closeConnector() {
>       //
>       echo "<p>in closeConnector()";
>       var_dump(DbConnector::$connector);

What is $connector ???

Perhaps you want DbConnector::connector

>       echo "</p>";
>
> 	 //make sure the db object is cleaned up properly
> 	 if ( gettype(DbConnector::$connector) == 'object' ) {
> 	  echo "<br><br>close the ADOdb connection<br><br>";
> 	  DbConnector::$connector->Close();

Try it without the $

If that's not it, try:
$connector = DbConnector::$connector;
$connector->Close();

Sometimes PHP is not so good at -> chasing down a tree...

Or, at least, it used to be not so good at that...  I suspect that's
been fixed for ages, but worth a shot.

>
> 	 }
>
>       //put things back the way they were found
>       $this->connector = false;
>     }
>
> DbConnector is meant to be a singleton class that manages an ADOdb
> object.  However, when the code executes and it gets to this line:
>
> DbConnector::$connector->Close();
>
> the script fails and says "Call to undefined method
> DbConnector::Close()"  Is trying to call the Close() method of the
> static member var (which holds an ADOdb object) not possible?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux