Fix appointment insertion in database

This commit is contained in:
coolneng 2020-07-10 13:08:07 +02:00
parent 3eab99b0f6
commit 2e2e0b67f0
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
2 changed files with 2 additions and 3 deletions

View File

@ -63,6 +63,7 @@
<button class="create_btn" type="submit" name="create" >Añadir cita</button>
<?php $doctor = fetchDoctor($pdo); ?>
<input type="hidden" name="doctor" value="<?php echo $doctor; ?>">
<input type="hidden" name="fecha" id="fecha">
</form>
<?php closeDatabase($pdo); ?>
</div>

View File

@ -403,9 +403,7 @@ function fetchDoctorHolidays($pdo, $doctor)
function createAppointment($pdo, $data){
$query = "INSERT INTO cita (fecha, hora, duracion, medico, observaciones, paciente) VALUES (?,?,?,?,?,?)";
$result = $pdo->prepare($query);
$result->execute([$data["fecha"], $data["hora"], $data["duracion"],
$pdo->prepare($query)->execute([$data["fecha"], $data["hora"], $data["duracion"],
$data["doctor"], $data["observaciones"], $data["paciente"]]);
$result->debugDumpParams();
return "Cita creada con éxito";
}