$badge = $_GET["badge"]; $res_checkin = $db->updateRecordIdKey($id, $key, "checked_in", 1); if (!$res_checkin) { $result["data"] = "Error: Could not check person in."; } else { $res_badge = $db->updateRecordIdKey($id, $key, "badge_id", $badge); if (!$res_badge) { $result["data"] = "Error: Could not update badge."; $res_checkin = $db->updateRecordIdKey($id, $key, "checked_in", 0); } else { // get all the checked in people $people = array("participants" => array(), "mentors" => array()); // fields desired $fields = array("id", "key", "name", "checked_in"); // get participants $participants = $db->getParticipants(); foreach ($participants as $id => $participant) { if ($participant["approved"] == 1 && $participant["unregistered"] == 0 && $participant["checked_in"] == 1) { foreach ($fields as $field) { $people["participants"][$participant["id"]][$field] = $participant[$field]; } } } // get mentors $mentors = $db->getMentors(); foreach ($mentors as $id => $mentor) { if ($mentor["unregistered"] == 0 && $mentor["checked_in"] == 1) { //$people["participants"][] = $mentor; foreach ($fields as $field) { $people["mentors"][$mentor["id"]][$field] = $mentor[$field]; }