vb.org Archive

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

sabret00the 01-22-2005 12:40 PM

conditional query
 
PHP Code:

  $grps_ids explode(' 'trim($bbuserinfo['grps']));
  
      if(
$grps_showgroup['moderate_members'] AND !in_array($grps_showgroup['groupid'], $grps_ids['0']))
      {
         eval(
"\$grps_postbits = \"".fetch_template("groups_display_postbit_private")."\";");
      } 

i'm wondering if i can do this conditional?

deathemperor 01-22-2005 01:07 PM

conditional of what ? what do you want with that code ?

and why do you have to place '\' in eval() ??

and is "in_array($grps_showgroup['groupid'], $grps_ids['0'])" correct ??

sabret00the 01-22-2005 01:20 PM

the conditional is if the moderate_members column has a value and the user doesn't have the groupid in his/her groups arrray column in the user table then it will show the template, the reason i've got the characters escaped is because i'm using quotation marks and not apostraphies. and the in_array is the groupdid first and the array it's looking in second. it's not spouting now errors so it should be right i hope so, the reason i'm asking is because it's not working, so i'm wonderinf if it's something like 'you can't use in_array like that in a conditional'

miz 01-23-2005 12:07 AM

i think your problem is some where at the end :

, $grps_ids['0']

what does it mean ?
dunno if i understod you right but its might need to be :
AND $grps_ids['0'] !=false
or whatever...

noppid 01-23-2005 12:18 AM

The syntax is...

in_array(needle, haystack) or in_array( single_element_variable, Array() )

Are you comparing two arrays? That won't work. If not, are the array and the single element variable on the correct sides of the function?

sabret00the 01-23-2005 12:45 AM

it should've been if($grps_showgroup['private_posts'] AND !in_array($grps_showgroup['groupid'], $grps_ids))

the first part of the conditional was wrong, i was checking the wrong column

deathemperor 01-24-2005 04:15 AM

why are you all wrong in this: in_array($grps_showgroup['groupid'], $grps_ids['0'] ?

the second param must be an array mate which $grps_ids['0'] is NOT.

sabret00the 01-24-2005 06:18 AM

Quote:

Originally Posted by deathemperor
why are you all wrong in this: in_array($grps_showgroup['groupid'], $grps_ids['0'] ?

the second param must be an array mate which $grps_ids['0'] is NOT.

i know i got it sorted, the in_array() was never the problem death, i was basically trying to make sure i could do that IF, if i could do a !in_array()

the $grps_ids['0'] was left over from debugging the values.


All times are GMT. The time now is 09:24 PM.

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.01236 seconds
  • Memory Usage 1,726KB
  • 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_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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