Jonathan Villa wrote:

> I am in a class as well as a constructor.
> 
> class DBI
> {
>       //var declarations
>       function DBI() 
>       {
>               $retVal = true;
>               
> $this->setDBConn(mysql_connect('localhost',$this->_dbuser,$this->_dbpwd));
>               if ($this->getDBConn() == false)
>                       $retVal = false;
>               if(mysql_select_db($this->getDBName(),$this->getDBConn())==false)
>                       $retVal = false;
>               return $retVal;
>       }
>       //more functions...     
> }

I'm guessing this is your class constructor?

If so then you can't access $this->_dbuser and $this->_dbpw because you
have not set their value anywhere.

You cannot set their value in the section you labeled "var declarations"
either. PHP does not allow values to be assigned to variables outside of
functions. So if you have any assignments in the var declaration section
put those at the top of your constructor.

Jean-Christian Imbeault


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

Reply via email to