I'm working on a project for school (Deadline in June; plenty of time given ^^).
At the moment there is a database in the conf.php (every other .php includes this one; it has a variable which references a mysqli-object) and i am accessing the database in every method of a classs via "global $db_conn;". The problem is, if I open just the class.php, it doesn't include the conf.php and it throws errors. So I thought about adding an private instance/static variable for the mysqli-Object with EVERY object. This is not working (unexpected T_NEW):
class foo{
private static $db_conn = new mysqli("", "", "", "");
}
How do you handle db-connections? How would you handle this specific problem?
Thanks in advance ^^