MyBB Community Forums

Full Version: Help to create table in database!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi I have this code that doesn't seems to work can you check it please!

Quote:function badwordblock_activate(){
global $mybb, $db;
if(!$db->table_exists("badwordblock"))
{
$db->query("CREATE TABLE IF NOT EXISTS ".TABLE_PREFIX."badwordblock (
blid smallint(5) unsigned NOT NULL AUTO_INCREMENT,
badword varchar(220) NOT NULL DEFAULT '',
PRIMARY KEY (blid)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;");
}
}

Error
Quote: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 MySQL server version for the right syntax to use near 'Type=MyISAM' at line 8
Query:
CREATE TABLE mybb_board_messages ( mid int(10) unsigned NOT NULL auto_increment, message text NOT NULL, class varchar(255) NOT NULL, global tinyint(1) NOT NULL default '1', enabled tinyint(1) NOT NULL default '0', PRIMARY KEY (mid) ) Type=MyISAM;
$db->query("CREATE TABLE IF NOT EXISTS " . TABLE_PREFIX . "badwordblock (
`blid` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`badword` varchar(220) NOT NULL DEFAULT '',
PRIMARY KEY (`blid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;");

However; your error is pointing to some other table creation query I guess, check what is at line no. 8 in your PHP.