I get this error: Call to a member function prepare() on a non-object in
require("gebruikersdata.php");
class Database
{
private $con;
public function _construct($host,$username,$password,$database)
{
$this->con = new PDO("mysql:host=".$host.";dbname=".$database,$username,$password);
}
public function getGebruiker($sql)
{
$statement = $this->con->prepare($sql);
$statement->execute();
while($row = $statement->fetch())
{
$dataSet[] = new GebruikersData ($row);
}
if (!empty($dataSet))
return $dataSet;
else
return null;
}
}
What am I doing wrong? Thank you in advance!