W class.user.php masz:
function __construct($DB_con)
{
$this->db = $DB_con;
}
i kiedy używasz go w logout.php :
$user = new USER();
Musisz przekazać $DB_con do __constructor lub utwórz __constructor który nie ma argumentów i dodaj kolejną funkcję, aby zainicjować DB :
function __construct()
{
}
public function initDB($DB_con)
{
$this->db = $DB_con;
}
a potem możesz go użyć w ten sposób:
$YourDB = whatever_get_DB();
$user = new USER();
// And when you need:
$user.initDB($YourDB);
lub tylko bez tego:
$YourDB = whatever_get_DB();
$user = new USER($YourDB);