function api_getPerson_id($id) { $db = new ParlDB(); $q = $db->query("select * from member\n\t\twhere person_id = '" . mysql_escape_string($id) . "'\n\t\torder by left_house desc"); if ($q->rows()) { $output = array(); $last_mod = 0; for ($i = 0; $i < $q->rows(); $i++) { $house = $q->field($i, 'house'); if ($house == 0) { $out = _api_getRoyal_row($q->row($i)); } else { if ($house == 1) { $out = _api_getMP_row($q->row($i)); } else { if ($house == 2) { $out = _api_getLord_row($q->row($i)); } else { if ($house == 3) { $out = _api_getMLA_row($q->row($i)); } else { if ($house == 4) { $out = _api_getMSP_row($q->row($i)); } } } } } $output[] = $out; $time = strtotime($q->field($i, 'lastupdate')); if ($time > $last_mod) { $last_mod = $time; } } api_output($output, $last_mod); } else { api_error('Unknown person ID'); } }
function _api_getMSP_output($q) { $output = array(); $last_mod = 0; for ($i = 0; $i < $q->rows(); $i++) { $out = _api_getMSP_row($q->row($i)); $output[] = $out; $time = strtotime($q->field($i, 'lastupdate')); if ($time > $last_mod) { $last_mod = $time; } } api_output($output, $last_mod); }