Possible Duplicate:
Global or Singleton for database connection?
i have a database class in database.php then on the same file i create an object;
$database = new Database(); 
Then i include this file into another file- this file has a class called Test inside Class Test has a method test_me.
inside test_me method i want to access $connection variable of Database class. how can i do this?
this is what i've tried;
function test_me(){
  global $connection;
  //use $connection on another function..
}
this gives me an error undefined variable $connection . any idea what i'm doing wrong?
 
     
     
    