far2slow Posted July 20, 2011 Share Posted July 20, 2011 i want to add gamer_xbgt to the array so i can do a json call for each gamer_xbgt name any help would be great // Grab all the team groups! $request = $smcFunc['db_query']('', ' SELECT mg.id_group, mg.group_name, mg.online_color, mg.stars, t.place, t.roworder FROM ({db_prefix}membergroups AS mg, {db_prefix}team AS t) WHERE mg.id_group = 18 ORDER BY t.roworder', array() ); while ($row = $smcFunc['db_fetch_assoc']($request)) { $row['stars'] = empty($row['stars']) ? array('', '') : explode('#', $row['stars']); $context['display_groups'][$row['place']][$row['id_group']] = array( 'name' => $row['group_name'], 'color' => $row['online_color'], 'image' => str_repeat('<img src="' . str_replace('$language', $context['user']['language'], isset($row['stars'][1]) ? $settings['images_url'] . '/' . $row['stars'][1] : '') . '" alt="*" border="0" />', empty($row['stars'][0]) || empty($row['stars'][1]) ? 0 : $row['stars'][0]), 'members' => array(), 'place' => $row['place'], ); { $query_members = $smcFunc['db_query']('', ' SELECT mem.id_member, mem.id_group, mem.real_name, mem.usertitle, IFNULL(lo.log_time, 0) AS is_online, IFNULL(a.id_attach, 0) AS id_attach, a.filename, a.attachment_type FROM {db_prefix}members AS mem LEFT JOIN {db_prefix}log_online AS lo ON (lo.id_member = mem.id_member) LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member) WHERE mem.id_group = {int:id_group} ' . (!empty($modSettings['team_additional_groups']) ? 'OR FIND_IN_SET({int:id_group}, mem.additional_groups)' : '') . ' ORDER BY mem.real_name ASC', array( 'id_group' => $row['id_group'] ) ); } // Looping through the members. while ($profile = $smcFunc['db_fetch_assoc']($query_members)) { $context['display_groups'][$row['place']][$row['id_group']]['members'][$type][] = array( 'id' => $profile['id_member'], 'group_id' => $profile['id_group'], 'name' => '<span style="color: ' . $row['online_color'] . ';">' . $profile['real_name'] . $profile['gamer_xbgt'] .'</span>', 'colorless_name' => $profile['real_name'], 'gamer_xbgt' => $profile['gamer_xbgt'] != '' && !isset($context['disabled_fields']['gamer_xbgt']), 'href' => $scripturl . '?action=profile;u=' . $profile['id_member'], 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['id_member'] . '"><span style="color: ' . $row['online_color'] . ';">' . $profile['real_name'] . '</span></a>', 'title' => $profile['usertitle'], 'online' => array( 'label' => $txt[$profile['is_online'] ? 'online' : 'offline'], $txt[$profile['is_online'] ? 'online' : 'offline'] . '</a>', 'image_href' => $settings['images_url'] . '/' . ($profile['is_online'] ? 'useron' : 'useroff') . '.gif', ), ); } $smcFunc['db_free_result']($query_members); } $smcFunc['db_free_result']($request); Quote Link to comment https://forums.phpfreaks.com/topic/242435-help-with-array/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.