Fix appointment insertion in database
This commit is contained in:
parent
3eab99b0f6
commit
2e2e0b67f0
|
@ -63,6 +63,7 @@
|
||||||
<button class="create_btn" type="submit" name="create" >Añadir cita</button>
|
<button class="create_btn" type="submit" name="create" >Añadir cita</button>
|
||||||
<?php $doctor = fetchDoctor($pdo); ?>
|
<?php $doctor = fetchDoctor($pdo); ?>
|
||||||
<input type="hidden" name="doctor" value="<?php echo $doctor; ?>">
|
<input type="hidden" name="doctor" value="<?php echo $doctor; ?>">
|
||||||
|
<input type="hidden" name="fecha" id="fecha">
|
||||||
</form>
|
</form>
|
||||||
<?php closeDatabase($pdo); ?>
|
<?php closeDatabase($pdo); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -403,9 +403,7 @@ function fetchDoctorHolidays($pdo, $doctor)
|
||||||
|
|
||||||
function createAppointment($pdo, $data){
|
function createAppointment($pdo, $data){
|
||||||
$query = "INSERT INTO cita (fecha, hora, duracion, medico, observaciones, paciente) VALUES (?,?,?,?,?,?)";
|
$query = "INSERT INTO cita (fecha, hora, duracion, medico, observaciones, paciente) VALUES (?,?,?,?,?,?)";
|
||||||
$result = $pdo->prepare($query);
|
$pdo->prepare($query)->execute([$data["fecha"], $data["hora"], $data["duracion"],
|
||||||
$result->execute([$data["fecha"], $data["hora"], $data["duracion"],
|
|
||||||
$data["doctor"], $data["observaciones"], $data["paciente"]]);
|
$data["doctor"], $data["observaciones"], $data["paciente"]]);
|
||||||
$result->debugDumpParams();
|
|
||||||
return "Cita creada con éxito";
|
return "Cita creada con éxito";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue