38960-vm/test_query.php
Flatlogic Bot f10cdedce9 debug3
2026-03-22 03:56:20 +00:00

16 lines
478 B
PHP

<?php
require_once 'db/config.php';
$db = db();
try {
$sql = "SELECT a.id, p.name as patient_name, a.start_time, a.patient_id, a.doctor_id
FROM appointments a
JOIN patients p ON a.patient_id = p.id
WHERE a.status = 'Scheduled'
ORDER BY a.start_time ASC";
$scheduled_appointments = $db->query($sql)->fetchAll();
print_r($scheduled_appointments);
} catch (PDOException $e) {
echo "Error: " . $e->getMessage();
}