MyBB Community Forums

Full Version: SQL error when updating groups
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

When I update any of my groups I get this errorĀ [Image: goraj2]http://prntscr.com/goraj2. I am not sure how I can fix this, I was trying to change the ts3_gid number, it changed but I still got this error.

Thanks
google search "mysql 1366 incorrect decimal value mybb"

I've just found multiple solutions to your issue
I'm not sure how I can do it with the exact issue I have?
looks like you are using Pick Group On Registration plugin.
it was coded for a older version of MyBB & might not be updated for a long time.

in the plugin file, default value for the field 'canjoinreg' needs to be changed to 0

after changing it in the plugin file,
plugin needs reinstalling or field's default value in the database also needs the change

{ please note : at present can't check the plugin file(s) }
Canjoinreg needs to be 0, exactly what shows on your error second to last line, conjoinreg is blank
(2017-09-23, 04:57 PM).m. Wrote: [ -> ]looks like you are using Pick Group On Registration plugin.
it was coded for a older version of MyBB & might not be updated for a long time.

in the plugin file, default value for the field 'canjoinreg' needs to be changed to 0

after changing it in the plugin file,
plugin needs reinstalling or field's default value in the database also needs the change

{ please note : at present can't check the plugin file(s) }

Would it be this section I would need to change?

	function groupregister_install()
{
	global $mybb, $db;
	
	$db->write_query("ALTER TABLE `".TABLE_PREFIX."usergroups` ADD `canjoinreg` INT(1) NOT NULL DEFAULT '0';");
	$db->write_query("ALTER TABLE `".TABLE_PREFIX."usergroups` ADD `alsojoinreg` INT(1) NOT NULL DEFAULT '0';");
}
oh! No.

you can try changing below [lines: 59, 60]
$updated_group['canjoinreg'] = $mybb->input['canjoinreg'];
$updated_group['alsojoinreg'] = $mybb->input['alsojoinreg']; 
to
$updated_group['canjoinreg'] = $mybb->get_input('canjoinreg', MyBB::INPUT_INT);
$updated_group['alsojoinreg'] = $mybb->get_input('alsojoinreg', MyBB::INPUT_INT); 

Note: php files should be saved with utf-8 encoding without Byte Order Mark.
in general, we use editor like Notepad++ or file editor at web host panel
Thanks that fixed it