Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-26-2003, 01:29 PM
mariannet's Avatar
mariannet mariannet is offline
 
Join Date: Mar 2003
Location: Denmark
Posts: 118
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 1064

Hi there

I know there is a lot of treads about 1064, but I try here anyway ;0)

I get this when trying to "Update Thread Info":
************************
Database error in vBulletin Control Panel 2.3.0:

Invalid SQL: UPDATE thread SET lastpost=1056897578,replycount=13,postusername='Fr eja', postuserid='8', lastposter='Freja',attach= WHERE threadid=1996
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 'WHERE threadid=1996' at line 1

mysql error number: 1064
************************
Reply With Quote
  #2  
Old 10-26-2003, 01:37 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
attach= WHERE
there should be a value behind attach

if it's produced by a hack, you may ask the author about an bugfixed version, if it's caused by vbulletin itself you should upgrade to the newest version
Reply With Quote
  #3  
Old 10-26-2003, 02:46 PM
cirisme cirisme is offline
 
Join Date: Jan 2003
Posts: 136
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by mariannet
Hi there

I know there is a lot of treads about 1064, but I try here anyway ;0)

I get this when trying to "Update Thread Info":
************************
Database error in vBulletin Control Panel 2.3.0:

Invalid SQL: UPDATE thread SET lastpost=1056897578,replycount=13,postusername='Fr eja', postuserid='8', lastposter='Freja',attach= WHERE threadid=1996
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 'WHERE threadid=1996' at line 1

mysql error number: 1064
************************
Are you using MySQL 4?

I ran into the same problem... it's because MySQL will return NULL when count(_) contains nothing, not 0, so you need to find this line and intval() it
Reply With Quote
  #4  
Old 10-26-2003, 03:33 PM
mariannet's Avatar
mariannet mariannet is offline
 
Join Date: Mar 2003
Location: Denmark
Posts: 118
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by cirisme
Are you using MySQL 4?

I ran into the same problem... it's because MySQL will return NULL when count(_) contains nothing, not 0, so you need to find this line and intval() it
Well, I will surely love you forever if this can fix it.

Where do I find the line (where to look) and sorry for not being in the know, what do you mean by intval() it?

I can add hacks, find most errors and find my way around mySQL if I know what to look for, but other than that, I'm really just a newbie to php and mySQL

I can update all counters, just not "Update treade info", that must give some idea of what file to look in?
Reply With Quote
  #5  
Old 10-27-2003, 07:58 AM
mariannet's Avatar
mariannet mariannet is offline
 
Join Date: Mar 2003
Location: Denmark
Posts: 118
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

My "Start update thread count" section in "functions.php"
compares ok with the original "functions.php":
*******************************
PHP Code:
function updatethreadcount($threadid) {
  global 
$DB_site,$threadcache;

    
$replies=$DB_site->query_first("SELECT COUNT(*)-1 AS replies, SUM(attachment.visible) AS attachsum
                                    FROM post
                                    LEFT JOIN attachment ON attachment.attachmentid=post.attachmentid
                                    WHERE threadid='
$threadid'");

    
$lastposts=$DB_site->query_first("SELECT user.username,post.username AS postuser,post.dateline
                                      FROM post
                                      LEFT JOIN user ON user.userid=post.userid
                                      WHERE post.threadid='
$threadid' AND visible>0
                                      ORDER BY dateline DESC
                                      LIMIT 1"
);
    
$lastposter=iif($lastposts['username']=="",$lastposts['postuser'],$lastposts['username']);
    
$lastposttime=$lastposts['dateline'];

    
$firstposts=$DB_site->query_first("SELECT post.userid,user.username,post.username AS postuser,post.dateline
                                       FROM post
                                       LEFT JOIN user ON user.userid=post.userid
                                       WHERE post.threadid='
$threadid' AND visible>0
                                       ORDER BY dateline
                                       LIMIT 1"
);
    
$firstposter=iif($firstposts['username']=="",$firstposts['postuser'],$firstposts['username']);
    
$firstposterid=$firstposts['userid'];

    
$DB_site->query("UPDATE thread SET postusername='".addslashes($firstposter)."',postuserid='$firstposterid',lastpost='$lastposttime',replycount='$replies[replies]',attach='$replies[attachsum]', lastposter='".addslashes($lastposter)."' WHERE threadid='$threadid'");


**************************

Does that mean that it is in the mySQL the problem is?
Reply With Quote
  #6  
Old 10-30-2003, 08:53 PM
assassingod's Avatar
assassingod assassingod is offline
 
Join Date: Jul 2002
Posts: 3,337
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Open misc.php
(Line 275 IIRC, I could be wrong though)
Find:
PHP Code:
attach=$attachsum 
Replace with
PHP Code:
attach=" . intval($attachsum) . " 
That should fix it
Reply With Quote
  #7  
Old 10-31-2003, 05:14 AM
mariannet's Avatar
mariannet mariannet is offline
 
Join Date: Mar 2003
Location: Denmark
Posts: 118
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by assassingod
Open misc.php
(Line 275 IIRC, I could be wrong though)
Find:
PHP Code:
attach=$attachsum 
Replace with
PHP Code:
attach=" . intval($attachsum) . " 
That should fix it

Thank you sooooo much :banana:
It's working perfectly now!
Reply With Quote
Reply


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 04:08 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.04134 seconds
  • Memory Usage 2,251KB
  • 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
  • (5)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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