vb.org Archive

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

mariannet 10-26-2003 01:29 PM

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
************************

Xenon 10-26-2003 01:37 PM

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

cirisme 10-26-2003 02:46 PM

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 :)

mariannet 10-26-2003 03:33 PM

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 :rolleyes:

I can update all counters, just not "Update treade info", that must give some idea of what file to look in?

mariannet 10-27-2003 07:58 AM

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?

assassingod 10-30-2003 08:53 PM

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

mariannet 10-31-2003 05:14 AM

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!


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