Fix appointment database insertion

This commit is contained in:
coolneng 2020-07-08 21:23:13 +02:00
parent d013659e74
commit c0764276e1
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
2 changed files with 5 additions and 4 deletions

View File

@ -23,7 +23,6 @@
$pdo = connectDatabase();
$patients = listPatients($pdo);
$calendar_settings = fetchCalendarSettings($pdo, $doctor);
$holidays = listHolidays($pdo);
?>
<?php if($_SESSION["user_type"] == 1 and !isset($_GET["medico"])): ?>
<form name="select_doctor" method="get" action="appointment.php">
@ -57,7 +56,7 @@
<select id="paciente" name="paciente">
<option>Seleccione un paciente</option>
<?php foreach ($patients as $row) : ?>
<option value="<?php echo $row[0]; ?>"><?php echo $row[1]; ?></option>
<option value="<?php echo $row[0]; ?>"><?php echo $row[2]; ?></option>
<?php endforeach ?>
</select>
</div>

View File

@ -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";
}