Ik ben bezig met een OOP script, echter krijg ik de volgende melding
Fatal error: Uncaught ArgumentCountError: Too few arguments to function Insert::__construct(), 0 passed in C:\xampp\htdocs\INSERT\index.php on line 57 and exactly 1 expected in C:\xampp\htdocs\INSERT\core.php:13 Stack trace: #0 C:\xampp\htdocs\INSERT\index.php(57): Insert->__construct() #1 {main} thrown in C:\xampp\htdocs\INSERT\core.php on line 13
Op het moment van schrijven heb ik drie bestanden aangemaakt.
- Core (bevat de insert class)
- databaseconnect.php (bevat connectie naar MariaDB)
- Index.php (roept insert classe aan)

Core.php
<?php
include 'databaseconnect.php';
class Insert
{
protected $dbConnection;
protected $title;
protected $Publisher;
protected $Genre;
protected $VisibleInStore;
public function __construct(PDO $dbConnection)
{
$this->dbCOnnection = $dbConnection;
}
public function Add($title, $Publisher, $Genre, $VisibleInStore)
{
$stmt = $this->dbConnection->prepare('INSERT INTO `game` ( `Title`, `Publisher`, `Genre`, `VisibleInStore`) VALUES ("$title" , "$Publisher", "$Genre", "$VisibleInStore")');
return exec($stmt);
$conn = null;
}
}
?>
databaseconnection.php
<?php
$dbConnection = new PDO('mysql:host=localhost;dbname=gameplanet', 'root', '');
?>
index.php
<?php
include 'core.php';
$insert = new Insert();
$insert->Add('title', 'Publisher', 'Genre', 'VisibleInStore')
?>