vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Vb option array (https://vborg.vbsupport.ru/showthread.php?t=168945)

wolfe 01-28-2008 08:43 AM

Vb option array
 
i have a vb option with a list of forum ids seperated by commas but when i use it in the php file $vbulletin->options[fids] in a query i get thread.forumid = (Array) error

how do i get around this.

thx in advance

Dismounted 01-28-2008 08:50 AM

Please post the code you are using.

wolfe 01-28-2008 09:22 AM

k

PHP Code:

    // Count all log entries
    
$tcount $vbulletin->db->query_first("
        SELECT COUNT(*) AS `tcount`
        FROM " 
TABLE_PREFIX "thread AS thread
        WHERE thread.forumid IN(
$vbulletin->options[fids])
    "
);
    
$vbulletin->db->free_result($fcount); 


Dismounted 01-28-2008 09:34 AM

PHP Code:

    // Count all log entries
    
$tcount $vbulletin->db->query_first("
        SELECT COUNT(*) AS `tcount`
        FROM " 
TABLE_PREFIX "thread AS thread
        WHERE thread.forumid IN(" 
$vbulletin->options['fids'] . ")
    "
);
    
$vbulletin->db->free_result($fcount); 


wolfe 01-28-2008 09:50 AM

thx m8 worked a treat what about this one this giving errors

PHP Code:

$forumchoic implode(','fetch_search_forumids($vbulletin->options['fids'] ,'')); 


Marco van Herwaarden 01-28-2008 10:20 AM

If that option contains a list of comma-seperated values, then you are probably looking for explode() to convert it to an array. Also the 3rd parameter is not needed.

wolfe 01-28-2008 10:24 AM

PHP Code:

$forumchoic explode(','fetch_search_forumids("".$vbulletin->options['fids'] . "")); 

not working m8 getting error

Fatal error: Cannot pass parameter 1 by reference in /home/freec/public_html/findex.php on line 100

Opserty 01-28-2008 02:48 PM

Why have you all of a sudden decided to put down quotes around your $vbulletin->options variable?

wolfe 01-29-2008 09:11 AM

because i get an (Array) error otherwise

Opserty 01-29-2008 04:51 PM

You must pass the forum id's as an array to the fetch_search_forumids() function. Make sure you read the code behind the function when you start using them, it will easily prevent you from getting these errors and also make understanding vBulletin a lot better.

If the fetch_search_forumids() is a string you need to first explode() the string into an array then pass this array to the function

N.B. You won't be able to do it inline as you must the variable by reference:
PHP Code:

$vbulletin->options['fids'] = explode(','$vbulletin->options['fids']);
$outcome fetch_search_forumids($vbulletin->options['fids']);
// implode the forum ids or whatever you want 

Again I can't stress enough that you learn a heck of a lot about how a function works by just looking at the PHP code behind it.


All times are GMT. The time now is 03:41 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.02369 seconds
  • Memory Usage 1,735KB
  • 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)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete