This is my sql connection code
$config['db'] = array('host' => 'localhost', 'username' =>  'root', 'password' => '', 'dbname' => 'reputize');
try
{
    $db = new PDO('mysql:host='.$config['db']['host'].';dbname'.$config['db']['dbname'], $config['db']['username'], $config['db']['password']);
    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
    echo "Database connected successfully";
}
catch(PDOException $e)
{
    echo $sql . "<br>" . $e->getMessage();
}
and this is the code i am using to fetch data from the table
$query = $db->query("select * from metaTags where filename='index'");
while ($row = $query->fetch(PDO::FETCH_ASSOC)) 
{   
    $ptitle=$row['MetaTitle'];
    $desc=$row['MetaDisc'];
    $kwords=$row['MetaKwd'];    
}
but the error keeps on showing
Call to a member function query() on a non-object in C:\xampp\htdocs\template OOP\include\class\websiteClasses.php on line 14
I have tried many solutions here and on other sites as well but of no use. Please help me out with this problem
 
     
     
    