Class within a Class... possible?
Posted: Fri Mar 12, 2004 9:04 am
Ok...
I have two classes.
dbConnect Class:
This is a very simple MySQL db class. It provides connection to a db and returns a variety of SQL Queries.
Mapp Class:
This class builds a very simple GRID map, for a game I play. It puts together a simple Table in HTML filled with Planets and Ships from this game.
INSIDE the Mapp Class, I have created an instance of the dbConnect class. This is causing problems. For instance, I created a Class Variable called $dbConnection, I generally set $dbConnection to:
$this->dbConnection( various args for db connection );
Then, inside the functions of my Mapp class I end up utilizing the dbConnect Class like this:
$this->dbConnection->select( $table, $args );
Should this work ok? I keep getting errors and I am not sure...
Is there a better way to do this?
HELP ME! If you can...
I have two classes.
dbConnect Class:
This is a very simple MySQL db class. It provides connection to a db and returns a variety of SQL Queries.
Mapp Class:
This class builds a very simple GRID map, for a game I play. It puts together a simple Table in HTML filled with Planets and Ships from this game.
INSIDE the Mapp Class, I have created an instance of the dbConnect class. This is causing problems. For instance, I created a Class Variable called $dbConnection, I generally set $dbConnection to:
$this->dbConnection( various args for db connection );
Then, inside the functions of my Mapp class I end up utilizing the dbConnect Class like this:
$this->dbConnection->select( $table, $args );
Should this work ok? I keep getting errors and I am not sure...
Is there a better way to do this?
HELP ME! If you can...