linkDB(); // If the connection is successful echo "Connected successfully using PDO"; } catch (Exception $e) { // Handle connection error error_log($e->getMessage()); // Log the error message echo "An error occurred while connecting to the database. Please try again later."; }