Use $GLOBALS['db'] (or whatever the variable name of the global variable is).

Justin Mazzi wrote:

I have made a Mysql database class. I wanted to know how I could use
that class in another class without using extend. For example:

include 'db.php';
$db = new db();

...some php code...


class blah {

var $test = 1;

function blah() {
......
$db->query(some query); //mysql class being used here
}
}

I don't want to create an instance of db class in the blah class because
I use db in other parts of the script so an instance already exists. Any
way I can do this?




--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to