Cześć,
a początk może pokażę błąd jaki otrzymuję:
Fatal error: Using $this when not in object context in C:\WebServ\httpd\oop_mvc\model\Forum\Stats.class.php on line 5
Teraz kod:
Plik Stats.class.php(Model):
<?php
class DownStatistics extends Database{
static public function Stats() {
$user_unactive = $this->getPdo()->prepare("SELECT `aktywny` FROM `users` LIMIT 1");
if (!$user_unactive->execute()){
print_r($user_unactive->errorInfo());
}
}
?>
Plik IndexForum.phtml(View):
<?php
$db = new Database();
$db->connect();
DownStatistics::Stats();
?>
Plik Forum.php(Controller):
<?php
require_once("../../controller/ConfigDatabase.class.php");
require_once("../../model/Forum/GetPlayerStatistics.class.php");
require_once("../../view/IndexForum.phtml");
?>
Z bazą łączę się się poprawnie. I tak jak pisałem wcześniej, błąd to:
Fatal error: Using $this when not in object context in C:\WebServ\httpd\oop_mvc\model\Forum\Stats.class.php on line 5
Odnosi się on do zapytania. Co jest nie tak?