Fix appointment database insertion
This commit is contained in:
parent
d013659e74
commit
c0764276e1
|
@ -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>
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue