MyBB Community Forums

Full Version: Puzzling SQL errors
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I merged a board about a month ago and my client is telling me he's getting weird errors via email.

I don't know what they mean and I don't know how to replicate them. He also says he's getting login issue errors but he needs to get me more details on that and tell me how to replicate that. For now, this is the error via email he's getting:

Quote:Type: 20
File: (Line no. 0)
Message
SQL Error: 1064 - 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 ')
ORDER BY p.dateline' at line 4
Query:
SELECT u.*, u.username AS userusername, p.*
FROM mybb_posts p
LEFT JOIN mybb_users u ON (u.uid=p.uid)
WHERE p.pid IN ()
ORDER BY p.dateline

We tried turning off all plugins and he still gets them whether they are on or off, so we know it's not a plugin.

He's using Godaddy hosting. They are USELESS. They refuse to look into it saying, "It's a scripting error." and that's that. HE refuses to move to a better hosting company, so I need to deal with this.

If it turns out it's a problem due to Godaddy, I think I can get him to move.
its not a host problem. the issue is that the code this is from is not providing a list of "pid" values that should be in the WHERE p.pid IN () line. there should be values in the ()

what page is this error happening?
The only page I was able to find that particular query is /archive/index.php around line 153. Not sure yet what is causing the problem. If you know the url where the error is occurring you know the thread id and that might give you some more information.
The only thing I can think of is that somehow the posts from a thread where removed or unapproved but the thread in the thread table is still visible.
Yeah, the problem is that it's coming to him via email so he has no idea who or what is causing it so I can't replicate it.

Could it be some kind of foul up from the merger?
Can you run a query in phpMyAdmin?
Try to run this query and see if there are any threads with no posts (c=0):
SELECT t.tid, (SELECT COUNT(pid) FROM mybb_posts p WHERE p.tid=t.tid) AS c FROM mybb_threads t ORDER BY c
Matt, I'm unsure what that means. Am I supposed to add the stuff in green in the lines they indicate or am I to change what's there already? <-- see, reading that I confused myself!

I never understand those things when they're shown to me.
OK Nevermind.... dopey me figured it out.

Another Question though -- I merged a site from phpbb2 to mybb and they are getting some page not found errors when hitting the last page of a multi-page thread. Would this do the same thing to fix it?

I've had this phenomenon on other mergers in the past but we always got around it by simply posting something and it sorted the thread out, but the folks on this board are busting my chops to no end, some even wanting to edit some of the showthread files and I'm not touching a damn thing.
Do you have any SEO plugins installed?? Try running the recount and rebuild tools in the Tools & Maintenance section of the ACP.
No SEO plugins but I'll give a try for the recount and rebuild again.

I did that after the merge but maybe we need to do that a couple of times? This is a very large board, over 200K posts and threads.
Shouldn't really need to do it multiple times; usually when people have this issue it's due to an SEO plugin, or running the recount and rebuild tools fixes it. Some other people have had it happen with no SEO plugins and after running the recount and rebuild tools though, but it's a very hard issue to try and debug as it's quite sporadic and isn't easily reproducible.