= {$level['lv_exp']} ORDER BY lv_exp ASC limit 0, 1"); if ($ch_rank['lv_exp'] < $level['lv_exp']) { $add_status = sql_fetch("SELECT SUM(lv_add_state) as status FROM {$g5['level_table']} where lv_exp > '{$ch_rank['lv_exp']}' and lv_exp <= '{$level['lv_exp']}'"); $add_status = $add_status['status']; } else if ($ch_rank['lv_exp'] > $level['lv_exp']) { $add_status = sql_fetch("SELECT SUM(lv_add_state) as status FROM {$g5['level_table']} where lv_exp <= '{$ch_rank['lv_exp']}' and lv_exp > '{$level['lv_exp']}'"); $add_status = $add_status['status'] * -1; } $result['rank'] = $level['lv_id']; $result['next_rank'] = $n_level['lv_id']; $result['add_point'] = $add_status; $result['rest_exp'] = ($n_level ? $n_level['lv_exp'] - $level['lv_exp'] : 0); return $result; }