PDO::ERRMODE_EXCEPTION]); if ($pdo) { echo "Connected to the $db database successfully!"; } } catch (PDOException $e) { die($e->getMessage()); } finally { if ($pdo) { $pdo = null; } } Code language: HTML, XML (xml)