Hey all,
I was wondering if it is possible to access methods of a class from within another class. I have an error reporting class and a database access class and i want the database class to be able to signal the error reporting object that an error has occoured. Here's some simple code to illustrate what i'm trying to do:
class database {
function dbconnect($host, $user, $pass, $db) {
mysql_connect($host, $user, $pass) or $errorObject->error('101', 'could not connect to database!');
}
}
The error class and the method error() that i called just contains some code to deal with the error that was passed to it. The code for my page creates a new error object (called $errorObject) and a new database object.
So, is there any way this can be done?
Any help would be greatly appreciated! Thank you!