instantiating a class within a method of a seperate class
Posted: Thu Feb 06, 2003 5:44 am
Can I initiate a class from within a method of a seperate class
For example, below is a class called Detect that has an attribute called $oBudDb, which I'd hoped to use in further methods within the Detect class. This attribute is assigned to another class seperate to Detect.
This other class, Remote_ibisdb1_MsSQL(), extends a Class DB_MsSQL().
However, when I debug this on ZDE a debug error is displayed:
Debug Error: ..\Class DB_MsSQL.inc line 116 - Call to undefined function: mssql_connect()
Can anyone help?
Might it be that an extended class cannot be called from within another class?
$user = new Detect( $_SESSION["ibis_username"] );
....
....
class Detect {
var $oBudDb; // database handling class
var $found;
var $loginID; // UserID
var $shtName; // USerName
var $fstName; // Firstname
var $LstName; // Surname
var $usrDept; // UserDept
var $scopeID; // UserAccess
var $depCode; // DeptCode
var $depDesc; // DeptDesc
var $depHldr; // BudHldr
var $depMngr; // LineMgr
var $ibisRef; // ibis_name
function Detect( $ibisRef ){
if( !class_exists( $oBudDb ) ) $oBudDb = new Remote_ibisdb1_MsSQL(); // Extension of DB_MsSQL with connects to a server and selects the database
$oBudDb->Query( "SELECT UserID, UserName, Surname, Firstname, UserDept, UserAccess ".
"FROM BudgetReport ".
"WHERE UserID = '".$_SESSION["ibis_username"]."' ".
"AND UserAccess IS NOT NULL ".
"GROUP BY UserID, UserName, Surname, Firstname, UserDept, UserAccess " );
The above line and this one have worked in similar circumstances but zend debugger seems to have a problem.
For example, below is a class called Detect that has an attribute called $oBudDb, which I'd hoped to use in further methods within the Detect class. This attribute is assigned to another class seperate to Detect.
This other class, Remote_ibisdb1_MsSQL(), extends a Class DB_MsSQL().
However, when I debug this on ZDE a debug error is displayed:
Debug Error: ..\Class DB_MsSQL.inc line 116 - Call to undefined function: mssql_connect()
Can anyone help?
Might it be that an extended class cannot be called from within another class?
$user = new Detect( $_SESSION["ibis_username"] );
....
....
class Detect {
var $oBudDb; // database handling class
var $found;
var $loginID; // UserID
var $shtName; // USerName
var $fstName; // Firstname
var $LstName; // Surname
var $usrDept; // UserDept
var $scopeID; // UserAccess
var $depCode; // DeptCode
var $depDesc; // DeptDesc
var $depHldr; // BudHldr
var $depMngr; // LineMgr
var $ibisRef; // ibis_name
function Detect( $ibisRef ){
if( !class_exists( $oBudDb ) ) $oBudDb = new Remote_ibisdb1_MsSQL(); // Extension of DB_MsSQL with connects to a server and selects the database
$oBudDb->Query( "SELECT UserID, UserName, Surname, Firstname, UserDept, UserAccess ".
"FROM BudgetReport ".
"WHERE UserID = '".$_SESSION["ibis_username"]."' ".
"AND UserAccess IS NOT NULL ".
"GROUP BY UserID, UserName, Surname, Firstname, UserDept, UserAccess " );
The above line and this one have worked in similar circumstances but zend debugger seems to have a problem.