Strange Problem

From: Date: Wed, 15 Jan 2003 16:39:01 +0000
Subject: Strange Problem
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-3310@lists.php.net to get a copy of this message
Hello, I am not sure if this belongs in this group but I am having a very strange problem with a class that I'm building. It seems to be transposing 2 member variables. Before the if( DB::isError($this->$db) ) line $this->$DBIsConnected=false and $this->$db is an oci8 pear class. After the call $this->$db is true "1" and $this->$DBIsConnected is an oci8 pear class. I've upgraded PHP to 4.3.0 and still no solutions. Somebody please help and tell me where I've gone wrong! Thanks, Serge. See the class below: require_once "DB.php"; class CAccountingDatabaseConnection { var $db; var $DBIsConnected; function CAccountingDatabaseConnection () { $this->$DBIsConnected=false; } function Connect () { // If we are already connected just return TRUE. if( $this->$DBIsConnected ) return true; $driver="oci8"; $user="acct"; $pass="acct\$pw"; $host="devel"; $dsn="{$driver}://{$user}:{$pass}@{$host}"; $this->$db=DB::connect($dsn,true); if( DB::isError($this->$db) ) $this->$DBIsConnected=false; else $this->$DBIsConnected=true; if( $this->$DBIsConnected ) { $this->$db->setFetchMode(DB_FETCHMODE_ASSOC); $this->$db->setOption("optimize","portability"); $this->$db->setOption("seqname_format","%s"); $this->$db->autoCommit(false); } return $this->$DBIsConnected; } function isConnected () { return $this->$DBIsConnected; } // Serialize function __sleep () { if( !$this->$DBIsConnected ) return; $this->Commit(); } // Unserialize function __wakeup () { $this->Connect(); } }

« previous php.pear.general (#3310) next »