'Database connection is not available.']); exit(); } try { // Fetch users with 'field_rep' role to act as inspectors // Changed user_identifier to username since user_identifier doesn't exist in the users table \ = \->prepare(\SELECT id username name FROM users WHERE role = field_rep \); \->execute(); \ = \->fetchAll(PDO::FETCH_ASSOC); echo json_encode(['success' => true, 'data' => \]); } catch (PDOException \) { http_response_code(500); error_log(\Database Error: \ . \->getMessage()); echo json_encode(['success' => false, 'message' => 'Failed to retrieve inspectors.']); exit(); } ?>