PDA

View Full Version : 1064


mariannet
10-26-2003, 01:29 PM
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
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
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
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":
*******************************
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='$lastpostt ime',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:

attach=$attachsum


Replace with

attach=" . intval($attachsum) . "


That should fix it

mariannet
10-31-2003, 05:14 AM
Open misc.php
(Line 275 IIRC, I could be wrong though)
Find:

attach=$attachsum


Replace with

attach=" . intval($attachsum) . "


That should fix it


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