I am getting following fatal error when i use PDO to connect and retrieve some output from MySQL
Fatal error: Call to a member function prepare() on a non-object in /home/ ... line 21
My PHP Code:
$dbConnection = new PDO('mysql:dbname=abc;host=127.0.0.1;charset=utf8', 'abc','abc');
$dbConnection->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$dbConnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $pdo->prepare('SELECT current_date()'); //line 21
$stmt->execute();