I am trying to use $dbc->connect_error to check if any error occurs while trying to connect to my databease. I always get an error page saying:
$dbc->connect_error
There is no connect_error. You should use exception:
try { $dbh = new PDO($dsn, $user, $password); } catch (PDOException $e) { echo 'Connection failed: ' . $e->getMessage(); }
Or if you do not want exception you can try errorCode and errorInfo