First, take a look at my code
<?php
try
{
$dbh = new PDO('mysql:host=$db_host;dbname=blogproject1','root','');
$dbh->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
$dbh->exec('SET NAMES "utf8"');
}
catch (PDOException $e)
{
die('Error: ' . $e->getMessage());
}
if(!defined('GUEST')) {
define('BASEPATH', dirname(dirname(__FILE__));
header('Location: ' . BASEPATH);
exit();
}
When it executed it gives me an error.. Looks like, the error is at the header function... Can you tell me how to fix it?