Se cambio la estructura por MVC
This commit is contained in:
parent
cac53c2d4a
commit
f8942a1d02
|
@ -4,15 +4,20 @@
|
||||||
class Database {
|
class Database {
|
||||||
private static $instance = null;
|
private static $instance = null;
|
||||||
private $mysqli;
|
private $mysqli;
|
||||||
|
private $host;
|
||||||
|
private $dbname;
|
||||||
|
private $user;
|
||||||
|
private $password;
|
||||||
|
private $Database;
|
||||||
|
|
||||||
private function __construct() {
|
public function __construct() {
|
||||||
$host = 'localhost';
|
$host = 'localhost';
|
||||||
$db = 'lania_cc';
|
$dbname = 'lania_cc';
|
||||||
$user = 'lania';
|
$user = 'lania';
|
||||||
$pass = 'l4n1@Cc';
|
$password = 'l4n1@Cc';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->mysqli = new mysqli($host, $user, $pass, $db);
|
$this->mysqli = new mysqli($host, $user, $password, $dbname);
|
||||||
|
|
||||||
// Verificar conexión
|
// Verificar conexión
|
||||||
if ($this->mysqli->connect_error) {
|
if ($this->mysqli->connect_error) {
|
||||||
|
@ -30,6 +35,8 @@ class Database {
|
||||||
}
|
}
|
||||||
return self::$instance->mysqli;
|
return self::$instance->mysqli;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
require_once './conexionBd.php';
|
require_once '../config/Database.php';
|
||||||
|
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
@ -61,12 +61,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
}
|
}
|
||||||
|
|
||||||
class Graficos{
|
class Graficos{
|
||||||
private $conexion;
|
private $Database;
|
||||||
protected $db;
|
protected $db;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->conexion = new Conexion();
|
$this->Database = new Database();
|
||||||
$this->db = $this->conexion->conectar();
|
$this->db = $this->Database->getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
async function recuperarCantidadGenero(tipoConsulta) {
|
async function recuperarCantidadGenero(tipoConsulta) {
|
||||||
try {
|
try {
|
||||||
const response = await fetch("./php/graficos.php", {
|
const response = await fetch("../controllers/graficos.php", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
@ -18,7 +18,7 @@ async function recuperarCantidadGenero(tipoConsulta) {
|
||||||
|
|
||||||
async function recuperarCantidadEdad(tipoConsulta) {
|
async function recuperarCantidadEdad(tipoConsulta) {
|
||||||
try {
|
try {
|
||||||
const response = await fetch("./php/graficos.php", {
|
const response = await fetch("../controllers/graficos.php", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
@ -36,7 +36,7 @@ async function recuperarCantidadEdad(tipoConsulta) {
|
||||||
|
|
||||||
async function recuperarCantidadEstado(tipoConsulta) {
|
async function recuperarCantidadEstado(tipoConsulta) {
|
||||||
try {
|
try {
|
||||||
const response = await fetch("./php/graficos.php", {
|
const response = await fetch("../controllers/graficos.php", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
@ -59,7 +59,7 @@ async function recuperarCantidadEstado(tipoConsulta) {
|
||||||
|
|
||||||
async function recuperarCantidadExamen(tipoConsulta) {
|
async function recuperarCantidadExamen(tipoConsulta) {
|
||||||
try {
|
try {
|
||||||
const response = await fetch("./php/graficos.php", {
|
const response = await fetch("../controllers/graficos.php", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
@ -82,7 +82,7 @@ async function recuperarCantidadExamen(tipoConsulta) {
|
||||||
|
|
||||||
async function recuperarCantidadFecha(tipoConsulta) {
|
async function recuperarCantidadFecha(tipoConsulta) {
|
||||||
try {
|
try {
|
||||||
const response = await fetch("./php/graficos.php", {
|
const response = await fetch("../controllers/graficos.php", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
|
|
@ -372,7 +372,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
const fechaFin = convertirFechaAFormatoISO(fechaFinInput);
|
const fechaFin = convertirFechaAFormatoISO(fechaFinInput);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch('./php/graficos.php', {
|
const response = await fetch('../controllers/graficos.php', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
|
|
@ -230,7 +230,7 @@
|
||||||
<!-- NAVBAR -->
|
<!-- NAVBAR -->
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
|
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
|
||||||
<script type="module" src="js/inicio.js"></script>
|
<script type="module" src="../js/inicio.js"></script>
|
||||||
<script src="https://website-widgets.pages.dev/dist/sienna.min.js" defer></script>
|
<script src="https://website-widgets.pages.dev/dist/sienna.min.js" defer></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Reference in New Issue