MyBB Community Forums

Full Version: SQL Error with plugin activation
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
I want to install the following plugin ( HTML in Posts ) : https://community.mybb.com/mods.php?action=view&pid=16
When I tried to activate it from the admin panel I have this error :
MyBB has experienced an internal SQL error and cannot continue.

In the php plugin file, the database insertion is like this :
function htmlposts_activate()
{
global $db, $lang;

// create settings group
$insertarray = array(
'name' => 'htmlposts', 
'title' => 'HTML in Posts', 
'description' => "Settings for HTML in Posts plugin.", 
'disporder' => 100, 
'isdefault' => 0
);
$gid = $db->insert_query("settinggroups", $insertarray);

I am on :
MyBB : MyBB 1.8.24
Server : 10.3.25-MariaDB-0+deb10u1 - Debian 10

In this post (https://community.mybb.com/thread-137925-page-2.html), the advice is to go on this file to see the database creation : https://github.com/mybb/mybb/blob/featur...tables.php

I am not an expert so I have downloaded a random plugin with a recent last build : https://community.mybb.com/mods.php?acti...d&pid=1264

In this plugin, the database creation is like this :
function abp_restricturl_install() {
global $db, $lang;
$lang->load(CN_ABPRURL);
$settinggroups = [
 'name' => CN_ABPRURL,
 'title' => $lang->abp_restricturl_setting_title,
 'description' => $lang->abp_restricturl_setting_desc,
 'disporder' => 0,
 'isdefault' => 0
 ];
$db->insert_query('settinggroups', $settinggroups);
$gid = $db->insert_id();
abp_restricturl_upgrade($gid);
rebuild_settings();
}

Do I need to change the respective parts concerning this in the "HTML in posts" plugin ?
Last time, it activated but I was under MySQL.

Or maybe it's not this ^^'
Edit :
There is insertion of the line
"htmlposts" "HTML in Posts" "Settings for HTML in Posts plugin." "100" "0"
In the table "mybb_settinggroups"
Can you set SQL errors to show full details under Server Maintaince options in the ACP? This should give us a better idea.
I can obtain this :
SQL Error:
    1366 - Incorrect integer value: '' for column `bddname`.`mybb_settings`.`sid` at row 1
Query:
    INSERT INTO mybb_settings (`sid`,`name`,`title`,`description`,`optionscode`,`value`,`disporder`,`gid`) VALUES ('','htmlposts_groups','Allowed Groups','Enter the group IDs that can use HTML in posts. (separated by a comma, can be blank to allow all)','text','4',1,34) 
And contrary to the table "mybb_settinggroups", nothing is created in "mybb_settings".

Edit :
I have seen in my database that the column "sid" is on "Null" -> "No" and "Extra" -> "AUTO_INCREMENT".
I have deleted the following lines in the php plugin file :
"sid"			=> NULL,
I suppose that the sid column will be automatically incremented by one with the creation of the line.

It works.

Is it a misconfiguration of my database or the plugin should accept this ?

Edit2 :
I also have an SQL error with this plugin ( Lock - Sell content in hide tags for newpoints ) : https://community.mybb.com/mods.php?action=view&pid=591

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
    1364 - Field 'description' doesn't have a default value
Query:
    INSERT INTO mybb_settinggroups (`name`,`title`,`disporder`,`isdefault`) VALUES ('lock','Lock Settings',1,0) 
I think for this one I should go with this : https://community.mybb.com/mods.php?acti...w&pid=1374 (equivalent plugin, needs database values transfer).