vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   sql query recursive exclude forums (https://vborg.vbsupport.ru/showthread.php?t=267953)

Mooff 08-04-2011 04:02 PM

sql query recursive exclude forums
 
Hi guys,

i'm trying to catch some information out of our board, but want to exclude specific categories, their subforums and the subforums of those subforums.

Is there an easy way to use a vb-function which allready does this in my custom sql query?

Help is greatly appreciated.

Disasterpiece 08-04-2011 10:04 PM

Code:

... WHERE forumid NOT IN 1,2,3,4,5,...
Applying this for subforums as well might be harder, where writing down all forums regardless of sub- or parenting forums are excluded.

Mooff 08-04-2011 10:57 PM

I know how to write it by hand. But that's not want i want. It has to be automated since we will add a lot of boards in those categories over the time (and it does affect more than 50 subforums as of right now - i didn't count).

So i'm looking for a vb-function which allready does what i want. There should be something in the search? Where one can search through a whole category.

kh99 08-04-2011 11:11 PM

The 'childlist' column of the forum table is a comma-separated list of all the children (and the children's children, etc) of a forum (The list includes the forum itself and -1, for some reason - maybe to mark the end of the list?). If you have the forum info (or the forum cache is filled in so you can get the info) you should be able to do something like "WHERE forumid NOT IN $forum['childlist']". (Or I suppose you could just use the field name if your query includes the forum table).


All times are GMT. The time now is 03:55 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.02234 seconds
  • Memory Usage 1,710KB
  • 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
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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