Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 06-18-2013, 12:47 PM
Sarcoth Sarcoth is offline
 
Join Date: Mar 2006
Location: Huntsville
Posts: 521
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@kh99 - I'll test it out and let you know. Thank you.

--------------- Added [DATE]1371565419[/DATE] at [TIME]1371565419[/TIME] ---------------

Output
Rows: 8
Group: 40
Username:
Group: 41
Group: 42
Username:
Username:
Username:
Username:
Username:
Username:
Username:
Group: 43

It is displaying the groups and the correct number of users per group, so that is good. Only problem is it is not displaying the usernames. I'm dissecting it now and will try to figure out where it is going wrong.

--------------- Added [DATE]1371569057[/DATE] at [TIME]1371569057[/TIME] ---------------

Your code:
PHP Code:
while($roster $db->fetch_array($result)) {
    
$ids explode(',',$roster['membergroupids']);
    
$ids[] = $roster['usergroupid'];
    foreach (
$ids AS $id) {
        
$rostergroups[$id][] = &$roster;
    }

1) I made a quick change inside the foreach statement:
PHP Code:
if (in_array($id$displaygroups)) {
    
$rostergroups[$id][] = &$roster;    //storing user data

That change forces it to only store the important groups I want to display on the roster. Cuts down on what is stored in the array.

But, The way the data is being stored in the array seems weird to me. It goes through each group (user and member) that the user belongs to. That's good. And thanks for showing me that, I never thought to just add the usergroupid to the membergroupids array; awesome.

Anyhow, this was somehow changing all the data stored each time to be the exact same. Check this out.

Code:
ID: 42
Array ( [42] => Array ( [0] => Array ( [userid] => 15 [usergroupid] => 42 [membergroupids] => 37 [username] => LordMaus [field43] => Mmaus ) ) )
-----Next-----
ID: 42
Array ( [42] => Array ( [0] => Array ( [userid] => 75 [usergroupid] => 42 [membergroupids] => 37 [username] => Maggie [field43] => Maggie ) [1] => Array ( [userid] => 75 [usergroupid] => 42 [membergroupids] => 37 [username] => Maggie [field43] => Maggie ) ) )
-----Next-----
ID: 42
Array ( [42] => Array ( [0] => Array ( [userid] => 258 [usergroupid] => 42 [membergroupids] => 37 [username] => Pyway [field43] => Enno ) [1] => Array ( [userid] => 258 [usergroupid] => 42 [membergroupids] => 37 [username] => Pyway [field43] => Enno ) [2] => Array ( [userid] => 258 [usergroupid] => 42 [membergroupids] => 37 [username] => Pyway [field43] => Enno ) ) )
-----Next-----
ID: 42
Array ( [42] => Array ( [0] => Array ( [userid] => 537 [usergroupid] => 42 [membergroupids] => 37 [username] => Ranis [field43] => Qinshi ) [1] => Array ( [userid] => 537 [usergroupid] => 42 [membergroupids] => 37 [username] => Ranis [field43] => Qinshi ) [2] => Array ( [userid] => 537 [usergroupid] => 42 [membergroupids] => 37 [username] => Ranis [field43] => Qinshi ) [3] => Array ( [userid] => 537 [usergroupid] => 42 [membergroupids] => 37 [username] => Ranis [field43] => Qinshi ) ) )
-----Next-----
ID: 42
Array ( [42] => Array ( [0] => Array ( [userid] => 20 [usergroupid] => 42 [membergroupids] => 37 [username] => Rraven [field43] => Rraven ) [1] => Array ( [userid] => 20 [usergroupid] => 42 [membergroupids] => 37 [username] => Rraven [field43] => Rraven ) [2] => Array ( [userid] => 20 [usergroupid] => 42 [membergroupids] => 37 [username] => Rraven [field43] => Rraven ) [3] => Array ( [userid] => 20 [usergroupid] => 42 [membergroupids] => 37 [username] => Rraven [field43] => Rraven ) [4] => Array ( [userid] => 20 [usergroupid] => 42 [membergroupids] => 37 [username] => Rraven [field43] => Rraven ) ) )
-----Next-----
ID: 40
Array ( [42] => Array ( [0] => Array ( [userid] => 2 [usergroupid] => 6 [membergroupids] => 22,33,37,40,49 [username] => Sarcoth [field43] => Sarcoth ) [1] => Array ( [userid] => 2 [usergroupid] => 6 [membergroupids] => 22,33,37,40,49 [username] => Sarcoth [field43] => Sarcoth ) [2] => Array ( [userid] => 2 [usergroupid] => 6 [membergroupids] => 22,33,37,40,49 [username] => Sarcoth [field43] => Sarcoth ) [3] => Array ( [userid] => 2 [usergroupid] => 6 [membergroupids] => 22,33,37,40,49 [username] => Sarcoth [field43] => Sarcoth ) [4] => Array ( [userid] => 2 [usergroupid] => 6 [membergroupids] => 22,33,37,40,49 [username] => Sarcoth [field43] => Sarcoth ) ) [40] => Array ( [0] => Array ( [userid] => 2 [usergroupid] => 6 [membergroupids] => 22,33,37,40,49 [username] => Sarcoth [field43] => Sarcoth ) ) )
-----Next-----
ID: 42
Array ( [42] => Array ( [0] => Array ( [userid] => 289 [usergroupid] => 42 [membergroupids] => 37 [username] => Warconan [field43] => WARKRZY ) [1] => Array ( [userid] => 289 [usergroupid] => 42 [membergroupids] => 37 [username] => Warconan [field43] => WARKRZY ) [2] => Array ( [userid] => 289 [usergroupid] => 42 [membergroupids] => 37 [username] => Warconan [field43] => WARKRZY ) [3] => Array ( [userid] => 289 [usergroupid] => 42 [membergroupids] => 37 [username] => Warconan [field43] => WARKRZY ) [4] => Array ( [userid] => 289 [usergroupid] => 42 [membergroupids] => 37 [username] => Warconan [field43] => WARKRZY ) [5] => Array ( [userid] => 289 [usergroupid] => 42 [membergroupids] => 37 [username] => Warconan [field43] => WARKRZY ) ) [40] => Array ( [0] => Array ( [userid] => 289 [usergroupid] => 42 [membergroupids] => 37 [username] => Warconan [field43] => WARKRZY ) ) )
-----Next-----
ID: 42
Array ( [42] => Array ( [0] => Array ( [userid] => 153 [usergroupid] => 42 [membergroupids] => 37 [username] => Wulvar [field43] => Wulvar ) [1] => Array ( [userid] => 153 [usergroupid] => 42 [membergroupids] => 37 [username] => Wulvar [field43] => Wulvar ) [2] => Array ( [userid] => 153 [usergroupid] => 42 [membergroupids] => 37 [username] => Wulvar [field43] => Wulvar ) [3] => Array ( [userid] => 153 [usergroupid] => 42 [membergroupids] => 37 [username] => Wulvar [field43] => Wulvar ) [4] => Array ( [userid] => 153 [usergroupid] => 42 [membergroupids] => 37 [username] => Wulvar [field43] => Wulvar ) [5] => Array ( [userid] => 153 [usergroupid] => 42 [membergroupids] => 37 [username] => Wulvar [field43] => Wulvar ) [6] => Array ( [userid] => 153 [usergroupid] => 42 [membergroupids] => 37 [username] => Wulvar [field43] => Wulvar ) ) [40] => Array ( [0] => Array ( [userid] => 153 [usergroupid] => 42 [membergroupids] => 37 [username] => Wulvar [field43] => Wulvar ) ) )
I changed the pointer (&$roster) to just $roster and that seemed to fix that problem. Here is the last print_r of the $rostergroups array.

Code:
ID: 42
Array ( [42] => Array ( [0] => Array ( [userid] => 15 [usergroupid] => 42 [membergroupids] => 37 [username] => LordMaus [field43] => Mmaus ) [1] => Array ( [userid] => 75 [usergroupid] => 42 [membergroupids] => 37 [username] => Maggie [field43] => Maggie ) [2] => Array ( [userid] => 258 [usergroupid] => 42 [membergroupids] => 37 [username] => Pyway [field43] => Enno ) [3] => Array ( [userid] => 537 [usergroupid] => 42 [membergroupids] => 37 [username] => Ranis [field43] => Qinshi ) [4] => Array ( [userid] => 20 [usergroupid] => 42 [membergroupids] => 37 [username] => Rraven [field43] => Rraven ) [5] => Array ( [userid] => 289 [usergroupid] => 42 [membergroupids] => 37 [username] => Warconan [field43] => WARKRZY ) [6] => Array ( [userid] => 153 [usergroupid] => 42 [membergroupids] => 37 [username] => Wulvar [field43] => Wulvar ) ) [40] => Array ( [0] => Array ( [userid] => 2 [usergroupid] => 6 [membergroupids] => 22,33,37,40,49 [username] => Sarcoth [field43] => Sarcoth ) ) )
Once that was fixed, the data is printing out correctly now. Thanks kh99. Looks like the only problem was your first &$roster.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:05 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.20641 seconds
  • Memory Usage 2,479KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_code
  • (3)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (1)post_thanks_box_bit
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)showthread_list
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_threadedmode.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete