require_once($_SERVER["DOCUMENT_ROOT"] . 'config.php');
class stuff{
public $dhb;
public function __construct(){
$dbh = new PDO('mysql:host=' . $database['host'] . ';dbname=' . $database['dbname'] . '', $database['user'], $database['password']);
}
}
In the example above I get this error:
Notice: Undefined variable: database in C:\wamp\www\career\inc\controller.php on line 11
How can I get access to the array I have in config.php
? It contains the $database
array.