Blooberry Blooberry - 5 months ago 22
SQL Question

FlashChat installation hiccup! SQL syntax error?

I've done away with the (14) and (11) but when trying to install tufat's Flashchat, I keep getting this error:


Could not create DB table 'smf_fc_bans'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 '(14) NOT NULL, userid int(11)
default NULL, banneduserid int(11) default NULL, r' at line 1


Granted I'm still such a novice. If someone could help me I would be so very very grateful.

Table structure for table
bans
:

CREATE TABLE `bans` (
`id` int NOT NULL auto_increment,
`created` timestamp NOT NULL,
`userid` int default NULL,
`banneduserid` int default NULL,
`roomid` int default NULL,
`ip` varchar default NULL,
KEY `id` (`id`),
KEY `userid` (`userid`),
KEY `created` (`created`)
) ENGINE=MyISAM;


Table structure for table
connections
:

CREATE TABLE `connections` (
`id` varchar(32) NOT NULL default '',
`updated` timestamp NOT NULL,
`created` timestamp NOT NULL,
`userid` int default NULL,
`roomid` int default NULL,
`state` tinyint(4) NOT NULL default '1',
`color` int default NULL,
`start` int default NULL,
`lang` char(2) default NULL,
`ip` varchar(16) default NULL,
`tzoffset` int default '0',
`chatid` int NOT NULL default '1',
PRIMARY KEY (`id`),
KEY `userid` (`userid`),
KEY `roomid` (`roomid`),
KEY `updated` (`updated`)
) ENGINE=MyISAM;


Table structure for table
ignors
:

CREATE TABLE `ignors` (
`created` timestamp NOT NULL,
`userid` int default NULL,
`ignoreduserid` int default NULL,
KEY `userid` (`userid`),
KEY `ignoreduserid` (`ignoreduserid`),
KEY `created` (`created`)
) ENGINE=MyISAM;


Table structure for table
messages
:

CREATE TABLE `messages` (
`id` int(11) NOT NULL auto_increment,
`created` timestamp NOT NULL,
`toconnid` varchar(32) default NULL,
`touserid` int(11) default NULL,
`toroomid` int(11) default NULL,
`command` varchar(255) NOT NULL default '',
`userid` int default NULL,
`roomid` int(11) default NULL,
`txt` text,
PRIMARY KEY (`id`),
KEY `touserid` (`touserid`),
KEY `toroomid` (`toroomid`),
KEY `toconnid` (`toconnid`),
KEY `created` (`created`)
) ENGINE=MyISAM AUTO_INCREMENT=14 ;


Table structure for table
rooms
:

CREATE TABLE `rooms` (
`id` int NOT NULL auto_increment,
`updated` timestamp NOT NULL,
`created` timestamp NOT NULL,
`name` varchar(64) NOT NULL default '',
`password` varchar(32) NOT NULL default '',
`ispublic` char(1) default NULL,
`ispermanent` int(11) default NULL,

PRIMARY KEY (`id`),
KEY `name` (`name`),
KEY `ispublic` (`ispublic`),
KEY `ispermanent` (`ispermanent`),
KEY `updated` (`updated`)
) WNGINW=MyISAM AUTO_INCREMENT=5 ;


Table structure for table
users
:

CREATE TABLE `users` (
`id` int NOT NULL auto_increment,
`login` varchar(32) NOT NULL default '',
`password` varchar(32) NOT NULL default '',
`roles` int NOT NULL default '0',
`profile` text,
PRIMARY KEY (`id`),
KEY `login` (`login`)
) ENGINE=MyISAM AUTO_INCREMENT=2 ;`

Answer

The varchar datatype requires a parameter like varchar(50)

CREATE TABLE `bans` (
       `id` int NOT NULL auto_increment,
       `created` timestamp NOT NULL,
       `userid` int default NULL,
       `banneduserid` int default NULL,
       `roomid` int default NULL,
       `ip` varchar( requires a number ) default NULL,    <-- HERE
       KEY `id` (`id`),
       KEY `userid` (`userid`),
       KEY `created` (`created`)
     ) ENGINE=MyISAM;

You also have an error in

CREATE TABLE `rooms` (
       `id` int NOT NULL auto_increment,
       `updated` timestamp NOT NULL,
       `created` timestamp NOT NULL,
       `name` varchar(64) NOT NULL default '',
       `password` varchar(32) NOT NULL default '', 
       `ispublic` char(1) default NULL,
       `ispermanent` int(11) default NULL,

       PRIMARY KEY  (`id`),
       KEY `name` (`name`),
       KEY `ispublic` (`ispublic`),
       KEY `ispermanent` (`ispermanent`),
       KEY `updated` (`updated`)
     ) WNGINW=MyISAM AUTO_INCREMENT=5 ;

WNGINW=MyISAM AUTO_INCREMENT=5 ;

Should be

ENGINE=MyISAM AUTO_INCREMENT=5 ;
Comments