My question is one about best practices. I am starting a large project and decided to use ADOdb as my database abstraction layer. I was wodering how i should pass the ADOdb $db object to each function that requires it.
I don't want to use
global $db;
I was thinking of creating a class called DB with $conn as a public static memeber:
class DB{
static public $conn;
}
this way any function that needs it can simply call '
class A{
public function getData(){
DB::$conn->query();
...
}
}
Is there a better way of doing this? should i use a stastic function 'get()' in DB instead of accessing the the connection direcly (the connection is created when the script starts, so i dont have to worry about checking the connection before accessing it).
Any advice would be appreciated
Thank you
etaham