Re: error when using $this

From: Date: Fri, 22 Aug 2003 00:19:38 +0000
Subject: Re: error when using $this
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-160371@lists.php.net to get a copy of this message
Has with classes to do... The error claims that code isn't in a class which makes it invalid as $this is the current class... If you aren't in a class then there's no $this... however, if you are in a class, you just found a bug or a typo in your script... -- // DvDmanDT MSN: dvdmandt@hotmail.com Mail: dvdmandt@telia.com "Jonathan Villa" <jvilla@isdesigndev.com> skrev i meddelandet news:1061510870.3585.2.camel@in-hoc-vince... > First of all, let me say that I am using PHP 5, but not including any > new php5 features, just installed it. > > Anyway, > > this is the offending code.. > > $retVal = true; > $this->setDBConn(mysql_connect('localhost',$this->_dbuser,$this->_dbpwd)); > if ($this->getDBConn() == false) > $retVal = false; > > and on my page I get the following error: > > Fatal error: Using $this when not in object context in /var/www/xxxxx > > Now this is code I've used time and time before...also, I have never > seen an error such as the above. > > Any ideas? >

« previous php.general (#160371) next »