i'm still learning about php ,please help me to find the answer for this
Fatal error: Uncaught Error: Call to a member function prepare() on null in C:\xampp\htdocs\mvc\app\models\Scamlegit_model.php:20 Stack trace: #0 C:\xampp\htdocs\mvc\app\controllers\scamlegit.php(7): Scamlegit_model->getAllScamlegit() #1 C:\xampp\htdocs\mvc\app\core\App.php(39): scamlegit->index() #2 C:\xampp\htdocs\mvc\public\index.php(5): App->__construct() #3 {main} thrown in C:\xampp\htdocs\mvc\app\models\Scamlegit_model.php on line 20
and this my code
<?php
class Scamlegit_model {
private $dbh;
private $stmt;
public function __contruct(){
$dsn = 'mysql:host=localhost;dbname=,mvc';
try{
$this->dbh = new PDO($dsn,'root','');
}catch(PDOException $e){
die($e->getMassage());
}
}
public function getAllScamlegit()
{
$this->stmt = $this->dbh->prepare('SELECT * FROM scamlegitinfo');
$this->stmt->execute();
return $this->stmt->fetchAll(PDO::FETCH_ASSOC);
}
}
PLEASE HELP ME 🙁