Запрос не выполняется, не уверен, где я ошибаюсь
На предыдущей странице были указаны номер лицензии доктора и дата из календаря javascript
Отправка значений с использованием функции fetchApponitment на следующую страницу->
if(isset($_POST['BookAppointment']))
{ $DOCTOR_LICENSE_NO = $_POST['DOCTOR_LICENSE_NO'];
$APPOINTMENT_DATE = $_POST['APPOINTMENT_DATE'];
}$appointmentdetails = fetchAppointments($DOCTOR_LICENSE_NO,$APPOINTMENT_DATE);
?>
<table class="table-style-three">
<thead>
<!-- display Doctor details header -->
<th>DOCTOR_LICENSE_NO</th>
<th>DOCTOR_FNAME</th>
<th>DOCTOR_LNAME</th>
<th>DOCTOR_EMAIL_ID</th>
<th>DOCTOR_PHONE</th>
<th>APPOINTMENT_DATE</th>
<th>APPOINTMENT_TIME</th>
<th>APPOINTMENT_STATUS</th>
</thead>
<tbody>
<?php
foreach($appointmentdetails as $displayAppointment) { ?> <!-- foreach is very important -->
<tr>
<td><?php print $displayAppointment['DOCTOR_LICENSE_NO']; ?></td>
<td><?php print $displayAppointment['DOCTOR_FNAME']; ?></td>
<td><?php print $displayAppointment['DOCTOR_LNAME']; ?></td>
<td><?php print $displayAppointment['DOCTOR_EMAIL_ID']; ?></td>
<td><?php print $displayAppointment['DOCTOR_PHONE']; ?></td>
<td><?php print $displayAppointment['APPOINTMENT_DATE']; ?></td>
<td><?php print $displayAppointment['APPOINTMENT_TIME']; ?></td>
<td><?php print $displayAppointment['APPOINTMENT_STATUS']; ?></td></tr>
<?php } ?>
</tbody>
</table>
</body>
</html>
<?php require_once("footer.php");?>
Функция выглядит так ->
function fetchAppointments($DOCTOR_LICENSE_NO,$APPOINTMENT_DATE) {
global $mysqli,$DOCTOR_LICENSE_NO, $APPOINTMENT_DATE, $db_table_prefix,$row;
$args = array($DOCTOR_LICENSE_NO, $APPOINTMENT_DATE);
//echo $DOCTOR_LICENSE_NO;
//echo $APPOINTMENT_DATE;
echo $args[0];
echo $args[1];
$stmt = $mysqli->prepare(
"SELECT doctor.DOCTOR_LICENSE_NO,
doctor.DOCTOR_FNAME,
doctor.DOCTOR_LNAME,
doctor.DOCTOR_EMAIL_ID,
doctor.DOCTOR_PHONE,
appointment.APPOINTMENT_DATE,
appointment.APPOINTMENT_TIME,
appointment.APPOINTMENT_STATUS
FROM doctor INNER JOIN appointment ON (doctor.DOCTOR_LICENSE_NO = appointment.DOCTOR_LICENSE_NO)
WHERE doctor.DOCTOR_LICENSE_NO= ?
AND appointment.APPOINTMENT_DATE= ? ");
$stmt->bind_param("ss",$args[0], $args[1]);
$stmt->execute();
$stmt->bind_result($DOCTOR_LICENSE_NO,$DOCTOR_FNAME, $DOCTOR_LNAME, $DOCTOR_EMAIL_ID, $DOCTOR_PHONE,$APPOINTMENT_DATE , $APPOINTMENT_TIME, $APPOINTMENT_STATUS);
while ($stmt->fetch()){
$row[] = array(
'DOCTOR_LICENSE_NO' => $DOCTOR_LICENSE_NO,
'DOCTOR_FNAME' => $DOCTOR_FNAME,
'DOCTOR_LNAME' => $DOCTOR_LNAME,
'DOCTOR_EMAIL_ID' => $DOCTOR_EMAIL_ID,
'DOCTOR_PHONE' => $DOCTOR_PHONE,
'APPOINTMENT_DATE' => $APPOINTMENT_DATE ,
'APPOINTMENT_TIME' => $APPOINTMENT_TIME,
'APPOINTMENT_STATUS' => $APPOINTMENT_STATUS
);
}
$stmt->close();
return ($row);
}
Задача ещё не решена.
Других решений пока нет …