Hube02
asked on
php nested classes
I have a class that I use for all of my MySQL functions. Connecting to the database, getting records writing records, etc...
I'm now developing a catalog for a client and I wish to use a class here as well. If I create a MySQL object inside of the new Catalog class, how do I refer to the properties of the MySQL object.
Here is an example of some of my code, not exact, but you should get the idea.
class Catalog {
var ...............
.............. more property definitions
var $db_connection;
function Catalog() {
if ($this->db_connection = new MySQL(DB_HOST, DB_USER, DB_PASSWORD, DB_DB)) {
}
-------------------------- -------
now, one of the properties of the MySQL object is $return_array. I would usually refer to this property as:
$db_connection->return_arr ay
within the Catalog Class would I refer to this property as $this->db_connection->retu rn_array ?
is this correct?
somehow that does not look right to me. Can someone tell me how to refer to that property? Am I going about this the wrong way? Is there a better way to accomplish what I am after?
I'm now developing a catalog for a client and I wish to use a class here as well. If I create a MySQL object inside of the new Catalog class, how do I refer to the properties of the MySQL object.
Here is an example of some of my code, not exact, but you should get the idea.
class Catalog {
var ...............
.............. more property definitions
var $db_connection;
function Catalog() {
if ($this->db_connection = new MySQL(DB_HOST, DB_USER, DB_PASSWORD, DB_DB)) {
}
--------------------------
now, one of the properties of the MySQL object is $return_array. I would usually refer to this property as:
$db_connection->return_arr
within the Catalog Class would I refer to this property as $this->db_connection->retu
is this correct?
somehow that does not look right to me. Can someone tell me how to refer to that property? Am I going about this the wrong way? Is there a better way to accomplish what I am after?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER