V class.user.php máte:
function __construct($DB_con)
{
$this->db = $DB_con;
}
a když jej použijete v logout.php :
$user = new USER();
Musíte předat $DB_con na __constructor nebo vytvořte __constructor který nemá žádné argumenty a přidejte další funkci pro inicializaci DB :
function __construct()
{
}
public function initDB($DB_con)
{
$this->db = $DB_con;
}
a pak to můžete použít takto:
$YourDB = whatever_get_DB();
$user = new USER();
// And when you need:
$user.initDB($YourDB);
nebo pouze bez tohoto:
$YourDB = whatever_get_DB();
$user = new USER($YourDB);