MyBB Community Forums

Full Version: I get a internal SQL error every so often
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey! 
  • Detailed description of your problem, including steps to reproduce if necessary: I get an internal SQL error every so often. It has happened with enabling a plugin and just now when adding a new forum to one of the categories. 
  • URL to your forum/URL to specific problematic page: https://christianboard.net 
  • New installation or upgrade (from which version of MyBB)? - new install...just installed yesterday. 
  • Test user account (if it requires additional permissions) - I don't have one
  • Screenshot or error text, verbatim 
I cannot get my screenshot to work....
[Image: T2vRdyK]
If you can't share a screenshot, copy the error message.
Before, don't forget to activate the error log :
>> Home » Board Settings » Server and Optimization Options Server and Optimization Options
- Error Logging Medium : log errors
- Error Type Medium : Warnings and errors
Okay! I’ll do that as soon as I get back to my computer.

Okay, I did those steps. What now?

Okay here is the error log:

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') ORDER BY tid DESC' at line 1
Query:
SELECT tid, DATE_FORMAT(FROM_UNIXTIME(lastpost),'%Y-%m-%dT%H:%i:%sZ') AS lastmod FROM mybbbj_threads WHERE NOT dateline = 0 AND fid NOT IN () ORDER BY tid DESC
Can you list your plugins? This doesn't seem to be a query from the core code.
I guess it hates the fid not in ().
You probably forget a setting in the faulty plugin, and probably a forum selection.
I think it started after installing this plugin: Yet Another Sitemap (YASM) (1.3)
Yes, looks like there is a bug in the query when guest group can see all the forums.
Open inc/plugins/yetanothersitemap.php and replace line 281 with:
if (trim($fids)!='') {
   $cadenafids = "AND fid NOT IN (".$fids.")";
} else {
   $cadenafids = '';
}
I replaced $cadenafids = "AND fid NOT IN (".$fids.")"; with what you mentioned.

So far, it's working. Smile

Hey, so now out of the blue the error says this and I cannot access the forums at all:

SQL Error:
1146 - Table 'MYUSERNAME_mybb885.mybb_users' doesn't exist
Query:
SELECT uid FROM mybb_users ORDER BY uid DESC LIMIT 1


---- I edited out my actual username.

I figured it out.

When I use the BAM+ Announcements plugin, I cannot use the variable {newestmember} in the announcement...it messes up when I do. Weird.
Same error for Mybb 1,8,x

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 tid DESC' at line 1