Frustration calling class from another class.
Posted: Wed Jul 26, 2006 9:35 pm
I'm running into a bit of frustration with something that I am trying to do and would appreciate any pointers in the right direction.
I'm setting up a class to do some authentication and a second class to handle the database connections.
The main script calls a method in the first class with an indicator to either open or closed the database connection. The method in the first class, when called to open a connection, will call a new instance of the second class, storing this class indicator in a porperty of the first class. Once this new instance is created it will call a method in the second class to establish the connection. The resource handle for the database connection is held in a property of the second class.
The method in the first class, when called to close the connection, will again call the same method in the second class with an indicator to close the connection.
This all seemed to work fine, until I decided to see if it would work over SSL. The database connection still opens over SSL, but it errors out with Fatal error: Call to a member function dbConnect() on a non-object
I'm wondering if it is how I am calling the method of the second function, and if there is a better way. Here is an abstract of what the calling line looks like:
Any help on what is happening would be appreciated.
I'm setting up a class to do some authentication and a second class to handle the database connections.
The main script calls a method in the first class with an indicator to either open or closed the database connection. The method in the first class, when called to open a connection, will call a new instance of the second class, storing this class indicator in a porperty of the first class. Once this new instance is created it will call a method in the second class to establish the connection. The resource handle for the database connection is held in a property of the second class.
The method in the first class, when called to close the connection, will again call the same method in the second class with an indicator to close the connection.
This all seemed to work fine, until I decided to see if it would work over SSL. The database connection still opens over SSL, but it errors out with Fatal error: Call to a member function dbConnect() on a non-object
I'm wondering if it is how I am calling the method of the second function, and if there is a better way. Here is an abstract of what the calling line looks like:
Code: Select all
$this->InstanceOfSecondClass->DatabaseMethod();