38960-vm/check_data.php
2026-03-22 10:15:48 +00:00

20 lines
663 B
PHP

<?php
require_once 'db/config.php';
$db = db();
// Fetch one patient
$patient = $db->query("SELECT id, name FROM patients LIMIT 1")->fetch(PDO::FETCH_ASSOC);
// Fetch one doctor (employee with position 'Doctor')
$doctor = $db->query("
SELECT e.id, e.name_en
FROM employees e
JOIN positions p ON e.position_id = p.id
WHERE UPPER(p.name_en) = 'DOCTOR'
LIMIT 1")->fetch(PDO::FETCH_ASSOC);
if ($patient && $doctor) {
echo "Found Patient: " . $patient['name'] . " (ID: " . $patient['id'] . ")\n";
echo "Found Doctor: " . $doctor['name_en'] . " (ID: " . $doctor['id'] . ")\n";
} else {
echo "Could not find patient or doctor.\n";
}