Getting a couple of errors and can\'t for the life of me see where I am falling down. Below is the functions file
that means DB_HOST
is not defined or DB_HOST
is not accessible in the current context.
Try place these varibles in the script at the begining instead of include('config.php');
define('DB_HOST','mysql:host=localhost;dbname=blog');
define('DB_USER','root');
define('DB_PASS','');
The constants you are using for Host
, User
and Password
haven't been defined yet. There's probably something wrong with your config.php
.
Use particular terms in place of reference...
For e.g.
$dbh = new PDO(DB_HOST, DB_USER, DB_PASS);
Change to...
$dbh = new PDO('localhost', 'root', '')
That would work.