You are connected to the database --- $dsn

"; } catch (PDOException $e) // handle a PDO exception (errors thrown by the PDO library) { // Call a method from any object, use the object's name followed by -> and then method's name // All exception objects provide a getMessage() method that returns the error message $error_message = $e->getMessage(); echo "

An error occurred while connecting to the database: $error_message

"; } catch (Exception $e) // handle any type of exception { $error_message = $e->getMessage(); echo "

Error message: $error_message

"; } ?>