MyBB Community Forums

Full Version: [Osx] Advanced Invitation System MySQL error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When I click generate code this comes up:

MyBB has experienced an internal SQL error and cannot continue.
SQL Error:1364 - Field 'used' doesn't have a default valueQuery:INSERT INTO mybbex_advinvitesystem_codes (code,creator,dateline) VALUES ('W1m4pEoRG5','1',1579808874)
Please contact the MyBB Group for technical support.
In /inc/plugins/advinvitesystem.php find:
<?php

$db->query('CREATE TABLE '.TABLE_PREFIX.'advinvitesystem_codes (
  id smallint(4) NOT NULL auto_increment,
  code varchar(10) NOT NULL,
  creator int NOT NULL,
  used int NOT NULL,
  usedby int NOT NULL,
  dateline int NOT NULL,
  PRIMARY KEY (id)
) ENGINE=innodb;');

And replace:
<?php

$db->query('CREATE TABLE ' . TABLE_PREFIX . 'advinvitesystem_codes (
  `id` smallint(4) NOT NULL auto_increment,
  `code` varchar(10) NOT NULL DEFAULT '',
  `creator` int NOT NULL DEFAULT 0,
  `used` int NOT NULL DEFAULT 0,
  `usedby` int NOT NULL DEFAULT 0,
  `dateline` int NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (id)
) ENGINE=innodb;');

(2020-01-23, 08:33 PM)Salvation Wrote: [ -> ]In /inc/plugins/advinvitesystem.php find:
<?php

$db->query('CREATE TABLE '.TABLE_PREFIX.'advinvitesystem_codes (
  id smallint(4) NOT NULL auto_increment,
  code varchar(10) NOT NULL,
  creator int NOT NULL,
  used int NOT NULL,
  usedby int NOT NULL,
  dateline int NOT NULL,
  PRIMARY KEY (id)
) ENGINE=innodb;');

And replace:
<?php

$db->query('CREATE TABLE ' . TABLE_PREFIX . 'advinvitesystem_codes (
  `id` smallint(4) NOT NULL auto_increment,
  `code` varchar(10) NOT NULL DEFAULT '',
  `creator` int NOT NULL DEFAULT 0,
  `used` int NOT NULL DEFAULT 0,
  `usedby` int NOT NULL DEFAULT 0,
  `dateline` int NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (id)
) ENGINE=innodb;');
Im getting a Syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ’ , ’ or ’)’
Oh, sorry. Wrong quotes.
Correct code:
<?php

$db->query("CREATE TABLE " . TABLE_PREFIX . "advinvitesystem_codes (
  `id` smallint(4) NOT NULL auto_increment,
  `code` varchar(10) NOT NULL DEFAULT '',
  `creator` int NOT NULL DEFAULT 0,
  `used` int NOT NULL DEFAULT 0,
  `usedby` int NOT NULL DEFAULT 0,
  `dateline` int NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (id)
) ENGINE=innodb;");
(2020-01-24, 08:45 PM)Salvation Wrote: [ -> ]Oh, sorry. Wrong quotes.
Correct code:
<?php

$db->query("CREATE TABLE " . TABLE_PREFIX . "advinvitesystem_codes (
  `id` smallint(4) NOT NULL auto_increment,
  `code` varchar(10) NOT NULL DEFAULT '',
  `creator` int NOT NULL DEFAULT 0,
  `used` int NOT NULL DEFAULT 0,
  `usedby` int NOT NULL DEFAULT 0,
  `dateline` int NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (id)
) ENGINE=innodb;");
Still getting the same mysql error sadly :/