From c0764276e1230e27d3df6599bf2fa23dcc265d2d Mon Sep 17 00:00:00 2001 From: coolneng Date: Wed, 8 Jul 2020 21:23:13 +0200 Subject: [PATCH] Fix appointment database insertion --- src/appointment.php | 3 +-- src/database.php | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/appointment.php b/src/appointment.php index 9c57e56..ba257f8 100644 --- a/src/appointment.php +++ b/src/appointment.php @@ -23,7 +23,6 @@ $pdo = connectDatabase(); $patients = listPatients($pdo); $calendar_settings = fetchCalendarSettings($pdo, $doctor); - $holidays = listHolidays($pdo); ?>
@@ -57,7 +56,7 @@ diff --git a/src/database.php b/src/database.php index 2c6bdd6..8fa853a 100644 --- a/src/database.php +++ b/src/database.php @@ -346,7 +346,9 @@ function fetchDoctorHolidays($pdo, $doctor) function createAppointment($pdo, $data){ $query = "INSERT INTO cita (fecha, hora, duracion, medico, observaciones, paciente) VALUES (?,?,?,?,?,?)"; - $pdo->prepare($query)->execute([$data["fecha"], $data["hora"], $data["duracion"], - $data["medico"], $data["observaciones"], $data["paciente"]]); + $result = $pdo->prepare($query); + $result->execute([$data["fecha"], $data["hora"], $data["duracion"], + $data["doctor"], $data["observaciones"], $data["paciente"]]); + $result->debugDumpParams(); return "Cita creada con éxito"; }