vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   print_membergroup_row() and array() Help ! (https://vborg.vbsupport.ru/showthread.php?t=268945)

K a M a L 08-22-2011 06:37 PM

print_membergroup_row() and array() Help !
 
sorry , it is my second thread today
I'm programming admin page and used the function
PHP Code:

print_membergroup_row (string $title, [string $name 'membergroup'], [integer $columns 0], [mixed $userarray NULL]) 

My strange problem is with last arrtibute , it is used to prefill usergrups with current values
when I write
PHP Code:

    print_membergroup_row("Title""recusergroup",2,array('usergroupid' => 0'membergroupids' => '1,2,3,4,5,6')); 

it works correctly and groups 1,2,3,4,5,6 are marked
I have variabe
PHP Code:

$groups=1,2,3,4,5,

when I write
PHP Code:

print_membergroup_row("Title""recusergroup",2,array('usergroupid' => 0'membergroupids' => $groups)); 

I get only group 1 marked
then I set
PHP Code:

$groups='1,2,3,4,5,6' 

it doesn't work correctly
the first and last number are ignored !! and groups 2,3,4,5 only marked !

kh99 08-22-2011 06:46 PM

I don't see any reason that this:

PHP Code:

print_membergroup_row("Title""recusergroup",2,array('usergroupid' => 0'membergroupids' => '1,2,3,4,5,6')); 


would not be the same as this:
PHP Code:

    $groups '1,2,3,4,5,6';
    
print_membergroup_row("Title""recusergroup",2,array('usergroupid' => 0'membergroupids' => $groups)); 

(but you definitely need the quotes around the list).

Also, it looks like there can not be any spaces, so make sure you're not doing this:
PHP Code:

$group ' 1,2,3,4,5,6 '


K a M a L 08-22-2011 07:02 PM

yes , I tried it with space and without and the problem is the same
but I made a solution
PHP Code:

$groups1,2,3,4,5,6// without quotes
print_membergroup_row("Title""recusergroup",2,array('usergroupid' => 0'membergroupids' => "'0,".$groups.",0'")); 

I added 0 at start and zero at end so it ignores the starting zero and end zero
but I'm still intersted to know why this happens

kh99 08-22-2011 07:09 PM

PHP Code:

$groups1,2,3,4,5,// without quotes 


Strange, I get an error when I try that in a test file. Maybe there's some option I don't know about.

K a M a L 08-22-2011 07:14 PM

You may forgot the semicolon :)

Badshah93 08-22-2011 07:17 PM

I just tried

PHP Code:

$groups '1,2,3,4,5,6';

print_membergroup_row("Title""recusergroup",2,array('usergroupid' => 0'membergroupids' => $groups)); 

and its working well..

kh99 08-22-2011 07:17 PM

Quote:

Originally Posted by K a M a L (Post 2236692)
You may forgot the semicolon :)

I tried it with a semicolon, I get this error:

Code:

Parse error: syntax error, unexpected ',' in test.php on line 9

Oh well, as long as you got it working.

K a M a L 08-22-2011 07:34 PM

thank you your help and time
by the way , I copied your code and it is working without problems
can you find the diffrence between your code and mine ?
I think the diffrence is that i didn't sleep for 20 hours :D

Badshah93 08-22-2011 07:56 PM

Quote:

Originally Posted by K a M a L (Post 2236703)
thank you your help and time
by the way , I copied your code and it is working without problems
can you find the diffrence between your code and mine ?
I think the diffrence is that i didn't sleep for 20 hours :D

write ur codes always in good notepad software like notepad++.


All times are GMT. The time now is 08:56 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.01048 seconds
  • Memory Usage 1,752KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (11)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete