<?php
$user = "root";
$pass = "";
try {
$dbh = new PDO('mysql:host=127.0.0.1:3306;dbname=practice', $user, $pass);
var_dump($dbh);
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
?>
I am using XAMPP for local development and I am new to the PDO. When I run this code over browser, I get this message "object(PDO)#1 (0) { }". I get the same message even when I change the $user or other details. If my code is not getting connected to database, then it should throw the exception, but it isn't. I am not getting this. Also, when I ran phpinfo();, I get API extension "mysql,mysqli,pdo_mysql" enabled.