MyBB Community Forums

Full Version: Mysql Error in Plugin Activation
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

iam getting a Mysql Error in plugin activation.iam trying to install no of plugins.but it will give error like this .

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1366 - Incorrect integer value: 'NULL' for column 'gid' at row 1
Query:
INSERT INTO mybb_settinggroups (gid,name,title,description,disporder,isdefault) VALUES ('NULL','hidelinks_settings','Hide Links to Guests','Settings for Hide Links to Guests plugin.','100','no')


How to Fix this Error.Please help me.

Thanks
apking
I am not sure I follow. Are you getting the error when you activate a plug i or when you go to the plug in screen?
in admin control panel ---> Plugins ->

when click on activate link.result will come like above msg



thanks
apking
What plugin are you trying to activate?
Change the NULL to "" instead. That's double quotes with nothing inbetween.
or change 'NULL' to NULL (without the quotes)
where can i change ? i am newbie.can you explain little more..
Open the plugin file, you placed in inc/plugins, with any text editor. Find 'NULL', and change it to NULL (without the quotes)
hi smethead,
thanks for your reply.

but iam trying like.still its getting same error



MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1366 - Incorrect integer value: '' for column 'gid' at row 1
Query:
INSERT INTO mybb_tollyforumsettinggroups (gid,name,title,description,disporder,isdefault) VALUES ('','hidelinks_settings','Hide Links to Guests','Settings for Hide Links to Guests plugin.','100','no')

Please contact the MyBB Group for support.


thanks
apking
Since the GID Column is AUTO_INCREMENT; you don't need to mention the GID column in your array;
And you probably will run into another issue with the settings; they also use a NULL =P
You can change the whole part into
function hidelinks_activate()
{
	global $db;

	$hidelinks_group = array(
		"name"			=> "hidelinks_settings",
		"title" 		=> "Hide Links to Guests",
		"description"	=> "Settings for Hide Links to Guests plugin.",
		"disporder"		=> "100",
		"isdefault"		=> "0",
	);
	$db->insert_query("settinggroups", $hidelinks_group);
	$gid = $db->insert_id();
	
	$hidelinks_setting_1 = array(
		"name"			=> "hidelinks_enabled",
		"title"			=> "Enable/Disable",
		"description"	=> "Enable Hide Links to Guests ?",
		"optionscode"	=> "yesno",
		"value"			=> "0",
		"disporder"		=> "1",
		"gid"			=> intval($gid),
	);
		
    $hidelinks_setting_2 = array(
        "name"			=> "hidelinks_message",
        "title"			=> "Message",
        "description"	=> "Insert the message here to be displayed to guests instead of links (You can use HTML):",
        "optionscode"	=> "textarea",
        "value"			=> "<font color=\"red\">Guests cannot see links in the messages. Please register to forum by clicking <a href=\"member.php?action=register\"><strong>here</strong></a> to see links.</font>",
        "disporder"		=> "5",
        "gid"			=> intval($gid),
        );
	
	$db->insert_query("settings", $hidelinks_setting_1);
	$db->insert_query("settings", $hidelinks_setting_2);
	
	// Optimizing database
	$db->query("OPTIMIZE TABLE ".TABLE_PREFIX."settinggroups");
	$db->query("OPTIMIZE TABLE ".TABLE_PREFIX."settings");
	$db->query("OPTIMIZE TABLE ".TABLE_PREFIX."sessions");
	
	// Rebuilding settings
    rebuildsettings();
}

So simple remove
		"gid"			=> "NULL",
&&
2x           "sid"			=> "NULL",