green bean question on singleton php5

From: Date: Wed, 16 Jan 2008 17:57:22 +0000
Subject: green bean question on singleton php5
Groups: php.general 
Request: Send a blank email to php-general+get-267413@lists.php.net to get a copy of this message
Hi, I am implementing this class dbaccess{ static $db=null; static $othervar=33; private function dbaccess(){
    dbaccess::$db= new mysqli("localhost",USER,PASSWD,DB);
    if(mysqli_connect_errno()){
      echo "no way";
    }
} public static function GetDb(){ if(dbaccess::$db==null){ dbaccess::$db= new dbaccess(); } return dbaccess::$db; } } $db=dbaccess::GetDE(); $db->query(..................); will fail...with Call to undefined method dbaccess::query() apparently $db is of type dbaccess... and thus has not does not have query implemented.... any hhelp appreciated..... JCG

« previous php.general (#267413) next »