Fix appointment database insertion
This commit is contained in:
parent
d013659e74
commit
c0764276e1
|
@ -23,7 +23,6 @@
|
||||||
$pdo = connectDatabase();
|
$pdo = connectDatabase();
|
||||||
$patients = listPatients($pdo);
|
$patients = listPatients($pdo);
|
||||||
$calendar_settings = fetchCalendarSettings($pdo, $doctor);
|
$calendar_settings = fetchCalendarSettings($pdo, $doctor);
|
||||||
$holidays = listHolidays($pdo);
|
|
||||||
?>
|
?>
|
||||||
<?php if($_SESSION["user_type"] == 1 and !isset($_GET["medico"])): ?>
|
<?php if($_SESSION["user_type"] == 1 and !isset($_GET["medico"])): ?>
|
||||||
<form name="select_doctor" method="get" action="appointment.php">
|
<form name="select_doctor" method="get" action="appointment.php">
|
||||||
|
@ -57,7 +56,7 @@
|
||||||
<select id="paciente" name="paciente">
|
<select id="paciente" name="paciente">
|
||||||
<option>Seleccione un paciente</option>
|
<option>Seleccione un paciente</option>
|
||||||
<?php foreach ($patients as $row) : ?>
|
<?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 ?>
|
<?php endforeach ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -346,7 +346,9 @@ 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 (?,?,?,?,?,?)";
|
||||||
$pdo->prepare($query)->execute([$data["fecha"], $data["hora"], $data["duracion"],
|
$result = $pdo->prepare($query);
|
||||||
$data["medico"], $data["observaciones"], $data["paciente"]]);
|
$result->execute([$data["fecha"], $data["hora"], $data["duracion"],
|
||||||
|
$data["doctor"], $data["observaciones"], $data["paciente"]]);
|
||||||
|
$result->debugDumpParams();
|
||||||
return "Cita creada con éxito";
|
return "Cita creada con éxito";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue