diff --git a/includes/conexionBD.php b/includes/conexionBD.php new file mode 100644 index 0000000..0d4636c --- /dev/null +++ b/includes/conexionBD.php @@ -0,0 +1,29 @@ + PDO::ERRMODE_EXCEPTION, + PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, + PDO::ATTR_EMULATE_PREPARES => false, + ]; + + return new PDO($dsn, $usuario, $pass, $opciones); + + } catch (PDOException $error) { + return [ + 'error' => 'No se pudo conectar a la base de datos.', + 'error_tecnico' => $error->getMessage() + ]; + } +} +?> \ No newline at end of file diff --git a/index.php b/index.php index a47b9e7..ee8d7dc 100644 --- a/index.php +++ b/index.php @@ -1,3 +1,4 @@ +