PDA

View Full Version : Database Error when Searching


Master Of Unive
07-02-2015, 07:50 AM
I received an email which notifies me a database error, it is as below

My forum doesn't happen a problem with it, search functions are still working.
Can anyone spot where the problem comes from, and how to reproduce it?

Database error in vBulletin 4.2.2:

Invalid SQL:

SELECT post.*,userfield.*, usertextfield.*, user.*, IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid,avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar,
customavatar.dateline AS avatardateline, customavatar.width AS width, customavatar.height AS height,
customavatar.height_thumb AS height_thumb, customavatar.width_thumb AS width_thumb, customavatar.filedata_thumb
FROM post AS post
LEFT JOIN user AS user ON (user.userid = post.userid)
LEFT JOIN userfield AS userfield ON (user.userid = userfield.userid)
LEFT JOIN usertextfield AS usertextfield ON (user.userid = usertextfield.userid)
LEFT JOIN avatar AS avatar ON (avatar.avatarid = user.avatarid)
LEFT JOIN customavatar AS customavatar ON (customavatar.userid = post.userid)
WHERE post.postid 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 10
Error Number : 1064
Request Date : Thursday, July 2nd 2015 @ 10:15:46 AM
Error Date : Thursday, July 2nd 2015 @ 10:15:46 AM
Script : http://xxxx.com/forum/search.php?searchid=318478
Referrer : http://xxxx.com/forum/search.php
IP Address : 60.xx.xx.xx
Username : someone
Classname : vB_Database

tanzeelniazi
07-02-2015, 06:32 PM
i think you need to repair tables in php admin

ForceHSS
07-02-2015, 09:25 PM
Invalid SQL errors are almost always related to modified code.

To troubleshoot this, first reupload all the original vB non-image files (except install.php). Make sure you upload these in ASCII format and overwrite the ones on the server. Also be sure to upload the admincp files to whichever directory you have set in your config.php file. Then run 'Suspect File Versions' in Diagnostics to make sure you have all the original files for your version and that none show 'File does not contain expected contents':

Admin CP -> Maintenance -> Diagnostics -> Suspect File Versions

[Note: In some cases you may also need to remove any of the listed .xml files in the includes/xml directory.]

Next, disable all products (except vB Blog and vB CMS if you are running the Suite.)

Admin CP -> Plugins & Products -> Manage Products -> Disable

Then manually uncheck all plugins that are not for 'vBulletin Blog' and vBulletin CMS' here:

Admin CP -> Plugins & Products -> Plugin Manager

Then if you still have this problem, create a new style and choose no parent style. This will force it to use the default templates. Finally empty your browser cache, close all browser windows then try again. Make sure you change to the new style and view your forums with it.

Do you have the same problem?

Master Of Unive
07-03-2015, 12:09 AM
Thanks for your replies.

But tasks mentioned above wouldn't solve the situation. The problem isn't consistent, it happened only once in a while. I'm trying to debug and reproduce but it will take too much time.

The only idea I can see through right now is the error comes from "Find user's latest posts"

ForceHSS
07-03-2015, 02:13 AM
You should follow my above, post it will at least rule out some things that can cause these problems and if it is what I said above it will find what is causing it so a fix can be found, but if you don't want to even try why post for help when a possible solution might be just a few mins of work

Master Of Unive
07-05-2015, 09:35 AM
Sorry, it seems that you misunderstood.

I will soon do as you mentioned but not now. My forum is quite large so I can't easily close it for a while just to find an error which rarely occurs (and doesn't really affect security)

However, the tasks you tell me to do are more likely reinstalling the forum, so I'm afraid I couldn't follow thoroughly.

ForceHSS
07-05-2015, 12:31 PM
You are not reinstalling your forum only uploading the files and you don't need to close your site while doing it

Lynne
07-05-2015, 02:29 PM
If you don't want to close your live site, then make a database backup of the live site and create a test forum. Then you can try to reproduce the error on the test forum and diagnose the problem there.

QSTR
12-08-2015, 06:25 PM
@master

I have the same error.
If I type in search 'dac diy' as unregistered user.... and I switch to the second page, voila:
SELECT post.*,userfield.*, usertextfield.*, user.*, IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid,avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar,
customavatar.dateline AS avatardateline, customavatar.width AS width, customavatar.height AS height,
customavatar.height_thumb AS height_thumb, customavatar.width_thumb AS width_thumb, customavatar.filedata_thumb
FROM post AS post
LEFT JOIN user AS user ON (user.userid = post.userid)
LEFT JOIN userfield AS userfield ON (user.userid = userfield.userid)
LEFT JOIN usertextfield AS usertextfield ON (user.userid = usertextfield.userid)
LEFT JOIN avatar AS avatar ON (avatar.avatarid = user.avatarid)
LEFT JOIN customavatar AS customavatar ON (customavatar.userid = post.userid)
WHERE post.postid IN (.);


vb 4.2.3, hooks disabled
No susp. files found.

PM with your plugins/products list. We can compare them.

Thanks.

--------------- Added 1449689399 at 1449689399 ---------------

Soo, I spent a half day with this, and I got something - so, what I did:
- copy of my PRD -> TEST, 1:1
- all non standard plugins/products -> DELETE
- cron jobs -> DISABLED
- overwrite vB files -> DONE
- check susp. files and delete non vB files -> DONE
- create new, clean style -> DONE
and.... what, nothing....

But - the funny thing now.
I didn't want to lose my time for Human Verfication, so I went to CP and disabled this function.
And... haha. Its working!

When I enable 'Human Verification' (Q&A) it crashes my board when I'm searching fe. 'dac diy' - of course I have to switch to the second page (or further)

@VB support - I can share You my board with files/db (with wiped passwords / emails / etc.) for tests.