vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   arrrggg! (https://vborg.vbsupport.ru/showthread.php?t=64070)

AN-net 04-18-2004 09:56 PM

arrrggg!
 
ok im using a database to store things for inside an array

here is my code:
PHP Code:

    if(in_array($bbuserinfo['usergroupid'], array($setting['whocanview_journals'])))
    { 

in the database it is 6,2. it only works if its just one number. anyone know why it isnt. note that if it passes to false it prints permission error. can someone please help?

assassingod 04-18-2004 09:59 PM

You probably need to use the explode function (http://uk.php.net/manual/en/function.explode.php):
PHP Code:

$whocanview $setting['whocanview_journals'];
if (
in_array($bbuserinfo['usergroupid'], explode(','$whocanview))) 


AN-net 04-18-2004 11:16 PM

what would that do? it would just put the 6 and 2 together wouldnt it?

assassingod 04-18-2004 11:18 PM

It'll take the , from the DB entry and make it work in that in_array.

AN-net 04-18-2004 11:21 PM

k

AN-net 04-18-2004 11:26 PM

still not working:(
PHP Code:

    $wcvexplode(','$setting[whocanview_journals]);
    if(
in_array($bbuserinfo['usergroupid'], array($wcv)))
    { 


assassingod 04-19-2004 12:40 AM

Just use:
PHP Code:

    $wcv $setting['whocanview_journals'];
    if (
in_array($bbuserinfo['usergroupid'], explode(','$wcv)))
    { 


Xenon 04-19-2004 01:59 PM

This way by steve will work.

but to learn different ways doesn't hurt ;)

you can use this way as well:
PHP Code:

eval("\$isingroup = in_array($bbuserinfo[usergroupid], array($setting[whocanview_journals]));");
if (
$isingroup)
{.... 


Dean C 04-19-2004 02:11 PM

Stop showing off Stefan ;) ^^

Xenon 04-19-2004 02:26 PM

well, it doesn't hurt to learn new ways, does it? :p


All times are GMT. The time now is 03:23 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.01539 seconds
  • Memory Usage 1,733KB
  • 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
  • (5)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete