vb.org Archive

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

wolfe 12-28-2007 12:11 PM

array in mysql
 
i cant get this array to work

PHP Code:

$array "59,63,64,69,72";

    
$threadarray $vbulletin->db->query_read("
        SELECT thread.*, icon.title AS icontitle, icon.iconpath
        FROM " 
TABLE_PREFIX "thread AS thread 
        LEFT JOIN " 
TABLE_PREFIX "icon AS icon ON(icon.iconid = thread.iconid)
        WHERE
            thread.visible = 1 AND thread.forumid IN ('" 
implode(","$array) . "')
        ORDER BY dateline DESC 
        LIMIT 15"
); 

it returns nothing except this error
Code:

Warning: implode() [function.implode]: Invalid arguments passed

Opserty 12-28-2007 12:20 PM

$array is not an array, its just a string. You don't need to implode it.

PHP Code:

// An Array
$array = array ( 59636472);
echo 
implode('-'$array); 
// Outputs 59-63-64-72 

But in your example you don't need to implode it because the numbers are already seperated by commas. So just change implode(",", $array) to $array.

wolfe 12-28-2007 03:45 PM

m8 thats not what i needed i need it to only show threads that are in them forumids ?

Lynne 12-28-2007 03:47 PM

I think he told you what you need to do:
Quote:

Originally Posted by wolfe (Post 1410876)
m8 thats not what i needed i need it to only show threads that are in them forumids ?

Quote:

Originally Posted by Opserty (Post 1410754)
$array is not an array, its just a string. You don't need to implode it.

So just change implode(",", $array) to $array.


wolfe 12-28-2007 03:47 PM

nevermind m8 that worked gr8 thx :P


All times are GMT. The time now is 12:39 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.00995 seconds
  • Memory Usage 1,724KB
  • 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
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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