MyBB Community Forums

Full Version: SQL Error: 1064 - You have an error in your SQL syntax
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello there

I switched to a new server when I enter the add-ons in the admin panel.

MyBB SQL Error
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 'rows FROM mybb_settinggroups WHERE name = 'myinsertbuttons'' at line 1 Query: SELECT COUNT(*) as rows FROM mybb_settinggroups WHERE name = 'myinsertbuttons'
Please contact the MyBB Group for technical support.

why is this the cause and how can I fix it

do not look up for english
The keyword rows is a reserved keyword. See here.
(2018-08-10, 11:59 AM)Wires Wrote: [ -> ]The keyword rows is a reserved keyword. See here.

Thank you for your interest

I do not understand from the link you give me how to find a solution
Unfortunately this issue is because of reserved words for MariaDB which cannot be used. This will be fixed in one of future releases.
(2018-08-21, 07:30 PM)Eldenroot Wrote: [ -> ]Unfortunately this issue is because of reserved words for MariaDB which cannot be used. This will be fixed in one of future releases.
I just migrated my forum from a crappy server to a better one at a new host, and went through the painstaking process of upgrading from 1.8.12 all the way to 1.8.19, one version at a time lol.

However, this issue appears to not yet be resolved in 1.8.19; I'm also getting the same error as above when visiting Configuration > Plugins.

As a test, I entered the query directly in the SQL box in phpMyAdmin, with quotes around the offending word: rows

SELECT COUNT(*) as "rows" FROM mybb_settinggroups WHERE name = 'myinsertbuttons'

That works just fine at my new host running MariaDB server version 10.2

Is there any way we can modify whatever MyBB script(s) is/are responsible for creating these queries ourselves while waiting for this fix to be included? If so, can some guidance be given as to what should be changed and where?

As it is now, I cannot access any plugins to reactivate them since the migration. Sad
MyBB has this in core? I am not sure ...
Please state which plugins are installed in your setup.

There is no setting called "myinsertbuttons" in default MyBB. That belongs to a plugin.

Edit:
Looks like you are using martec's My Insert Buttons plugin. There are 2 instances in the plugin:

Line 46:

	$query	= $db->simple_select("settinggroups", "COUNT(*) as rows");
	$dorder = $db->fetch_field($query, 'rows') + 1;

and line 94:

	$query = $db->simple_select("settinggroups", "COUNT(*) as rows", "name = 'myinsertbuttons'");
	$rows  = $db->fetch_field($query, 'rows');

Change the rows to something else and it should fix the issue:
For example:

	$query = $db->simple_select("settinggroups", "COUNT(*) as r", "name = 'myinsertbuttons'");
	$rows  = $db->fetch_field($query, 'r');
Ah yep, you're right, the queries are in the plugin.

And that's not the only one I have installed with similar queries, so got some editing to do.

Thanks for spotting that. Smile