diff --git a/app/database/database.php b/app/database/database.php new file mode 100644 index 0000000..fdaed2f --- /dev/null +++ b/app/database/database.php @@ -0,0 +1,59 @@ + PDO::ERRMODE_EXCEPTION, + PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, + ]); + + return self::$connection; // Retorna la conección lista para usar + + } catch (PDOException $e) { + + // Log interno + + error_log($e->getMessage()); + + // Muestra mensaje amigable + + die("Ocurrió un error inesperado. Por favor, comuníquese con un administrador o intente denuevo mas tarde."); + + // Mensaje para desarrollo --> + + // die("Error de conexión a la base de datos: " . $e->getMessage()); + } + } +} \ No newline at end of file