diff --git a/config/Database.php b/config/Database.php
index 5bf0a51..ad16fbc 100644
--- a/config/Database.php
+++ b/config/Database.php
@@ -4,15 +4,20 @@
class Database {
private static $instance = null;
private $mysqli;
+ private $host;
+ private $dbname;
+ private $user;
+ private $password;
+ private $Database;
- private function __construct() {
+ public function __construct() {
$host = 'localhost';
- $db = 'lania_cc';
+ $dbname = 'lania_cc';
$user = 'lania';
- $pass = 'l4n1@Cc';
+ $password = 'l4n1@Cc';
try {
- $this->mysqli = new mysqli($host, $user, $pass, $db);
+ $this->mysqli = new mysqli($host, $user, $password, $dbname);
// Verificar conexión
if ($this->mysqli->connect_error) {
@@ -30,6 +35,8 @@ class Database {
}
return self::$instance->mysqli;
}
+
+
}
?>
\ No newline at end of file
diff --git a/php/buscarCodigo.php b/controllers/buscarCodigo.php
similarity index 100%
rename from php/buscarCodigo.php
rename to controllers/buscarCodigo.php
diff --git a/php/graficos.php b/controllers/graficos.php
similarity index 98%
rename from php/graficos.php
rename to controllers/graficos.php
index ef64836..69904b5 100644
--- a/php/graficos.php
+++ b/controllers/graficos.php
@@ -1,5 +1,5 @@
conexion = new Conexion();
- $this->db = $this->conexion->conectar();
+ $this->Database = new Database();
+ $this->db = $this->Database->getInstance();
}
diff --git a/js/funcionesGraficos.js b/js/funcionesGraficos.js
index 0458521..1b7cc66 100644
--- a/js/funcionesGraficos.js
+++ b/js/funcionesGraficos.js
@@ -1,6 +1,6 @@
async function recuperarCantidadGenero(tipoConsulta) {
try {
- const response = await fetch("./php/graficos.php", {
+ const response = await fetch("../controllers/graficos.php", {
method: "POST",
headers: {
"Content-Type": "application/json",
@@ -18,7 +18,7 @@ async function recuperarCantidadGenero(tipoConsulta) {
async function recuperarCantidadEdad(tipoConsulta) {
try {
- const response = await fetch("./php/graficos.php", {
+ const response = await fetch("../controllers/graficos.php", {
method: "POST",
headers: {
"Content-Type": "application/json",
@@ -36,7 +36,7 @@ async function recuperarCantidadEdad(tipoConsulta) {
async function recuperarCantidadEstado(tipoConsulta) {
try {
- const response = await fetch("./php/graficos.php", {
+ const response = await fetch("../controllers/graficos.php", {
method: "POST",
headers: {
"Content-Type": "application/json",
@@ -59,7 +59,7 @@ async function recuperarCantidadEstado(tipoConsulta) {
async function recuperarCantidadExamen(tipoConsulta) {
try {
- const response = await fetch("./php/graficos.php", {
+ const response = await fetch("../controllers/graficos.php", {
method: "POST",
headers: {
"Content-Type": "application/json",
@@ -82,7 +82,7 @@ async function recuperarCantidadExamen(tipoConsulta) {
async function recuperarCantidadFecha(tipoConsulta) {
try {
- const response = await fetch("./php/graficos.php", {
+ const response = await fetch("../controllers/graficos.php", {
method: "POST",
headers: {
"Content-Type": "application/json",
diff --git a/js/inicio.js b/js/inicio.js
index 98bcc8f..28a7d30 100644
--- a/js/inicio.js
+++ b/js/inicio.js
@@ -372,7 +372,7 @@ document.addEventListener('DOMContentLoaded', () => {
const fechaFin = convertirFechaAFormatoISO(fechaFinInput);
try {
- const response = await fetch('./php/graficos.php', {
+ const response = await fetch('../controllers/graficos.php', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
diff --git a/views/inicio.html b/views/inicio.html
index 856d2a9..a26c1ba 100644
--- a/views/inicio.html
+++ b/views/inicio.html
@@ -230,7 +230,7 @@
-
+