Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 03-03-2010, 04:56 AM
sunilvarma's Avatar
sunilvarma sunilvarma is offline
 
Join Date: Sep 2005
Location: Gainesville, FL
Posts: 75
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default SQL Error - Need Help

I have a plugin with the following code:

PHP Code:
###hack
if ($vbulletin->userinfo['permissions']['cispermissions'] & $vbulletin->bf_ugp_cispermissions['can_thread']) {

    
$user_ig $vbulletin->db->query_read("SELECT threadid from "TABLE_PREFIX ."cis_thread_ignore where userid = " $vbulletin->userinfo['userid'] . " and ig_type = 'thread'");

    while (
$ignores $vbulletin->db->fetch_array($user_ig)) {
    
        
$ignored .= "$ignores[threadid], ";

    }
    
    if (
$ignored != '') { $ignored substr($ignored0, -2); $globalignore .= $hook_query_where .= " AND thread.threadid NOT IN($ignored)"; }

    if (
$vbulletin->userinfo['cis_ignorelist_ignore']) { 

        
$ignore_users preg_replace('#\s+#s'','$vbulletin->userinfo['ignorelist']);

        if (
$ignore_users != '') {

            
$hook_query_where .= " AND thread.postuserid NOT IN($ignore_users)";

        }

    }

}

if (
$vbulletin->userinfo['permissions']['cispermissions'] & $vbulletin->bf_ugp_cispermissions['can_ignore_tag']) {

    if (
$vbulletin->userinfo['cis_ignoretags_ignore'] != '') {

        require_once(
DIR '/includes/functions_newpost.php');

        include_once(
DIR '/cis_includes.php');

        
$tags fetch_valid_tags('',split_tag_list($vbulletin->userinfo['cis_ignoretags_ignore']), $errors);

        foreach (
$tags as $item) {
                    
            
$tag $db->query_first("
            SELECT *
            FROM " 
TABLE_PREFIX "tag
            WHERE tagtext = '" 
$db->escape_string($item) . "'");

            if (
$tag['tagid'] != '') { 

                
$tagged[$tag[tagid]] = $tag[tagid];

            }


        }
                
        if (!empty(
$tagged)) {

            foreach (
$tagged as $tag) {
                        
                
$dotags $vbulletin->db->query_read("SELECT contentid from "TABLE_PREFIX ."tagcontent where tagid = $tag");

                while (
$igs $vbulletin->db->fetch_array($dotags)) {
                            
                    
$ignore_tags .= "$igs[threadid], "

                }
            }
                
        }

        if (
$ignore_tags != '') {

            
$ignore_tags substr($ignore_tags0, -2);

            
$hook_query_where .= " AND thread.threadid NOT IN ($ignore_tags)";
            
        }

    }

}

### 
It's causing the following DB error:


Code:
Database error in vBulletin 4.0.2:
 
Invalid SQL:
 
		SELECT COUNT(*) AS threads, SUM(IF(thread.lastpost > 1267592343 AND open <> 10, 1, 0)) AS newthread
		
		FROM thread AS thread
		
		
		WHERE forumid = 2
			AND sticky = 0
			
			 AND visible = 1 
			
			
			
			 AND thread.threadid NOT IN ();
 
MySQL Error   : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 13
Error Number  : 1064
Request Date  : Wednesday, March 3rd 2010 @ 01:55:07 AM
Error Date    : Wednesday, March 3rd 2010 @ 01:55:07 AM
Script        : http://localhost/vb40/forumdisplay.php?2-Main-Forum
Referrer      : http://localhost/vb40/
IP Address    : 127.0.0.1
Username      : test1
Classname     : vB_Database
MySQL Version :
Any help would be appreciated.

Thanks
Sunil
Reply With Quote
  #2  
Old 03-03-2010, 12:09 PM
ChopSuey ChopSuey is offline
 
Join Date: Jun 2009
Location: Alaska
Posts: 2,140
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can view: Getting error 1064?

Hope that helps.
Reply With Quote
  #3  
Old 03-03-2010, 04:37 PM
sunilvarma's Avatar
sunilvarma sunilvarma is offline
 
Join Date: Sep 2005
Location: Gainesville, FL
Posts: 75
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I tried that but it doesn't help.

This same plugin actually runs in vB 3.7 without any issues. So, I think there's some code that's changed in vB 4 that's causing the error?

Thanks

--------------- Added [DATE]1267661475[/DATE] at [TIME]1267661475[/TIME] ---------------

figured it out.

the tagthread table in vb 3.7 is changed to tagcontent in vB 4. I changed that in the query but I overlooked the part where the code's still looking for threadid (3.7) instead of contentid (4.0)
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:02 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04726 seconds
  • Memory Usage 2,204KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete