Re: include/require not allowed in classes?

From: Date: Fri, 14 Nov 2003 10:39:05 +0000
Subject: Re: include/require not allowed in classes?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-169628@lists.php.net to get a copy of this message
Ryan A wrote:
... class ads_DB extends DB_Sql {
  var $Host     = $MR_Host;
var $Database = $MR_Database;
  var $User     = $MR_User;
var $Password = $MR_Password; }
I think, Your problem is here. If i remember correctly, then PHP4 doesn't allow to initialize "var"-s with non-constant values. Solutions: 1) Define those connection parameters as constants, i.e. define( 'MR_Host', "some.host" ) etc. And use those constants in "ads_DB"-class definition. 2) Create constructor for "ads_DB"-class and initialize "var"-s there. Hope that helps. :) -- Pavel a.k.a. Papi

« previous php.general (#169628) next »