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"; }