trilbyfish Posted April 21, 2008 Share Posted April 21, 2008 I am having a problem when running some code, and i get the following 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 'CREATE TABLE bookingtable3 ( baynumber tinyint(2) NOT NULL auto_increment, ' at line 2 I do not know why this is because it is automatically generated code. Thanks in advance Quote Link to comment Share on other sites More sharing options...
fenway Posted April 21, 2008 Share Posted April 21, 2008 Well, we'll need to see the entire statement. Quote Link to comment Share on other sites More sharing options...
trilbyfish Posted April 21, 2008 Author Share Posted April 21, 2008 ("DROP TABLE IF EXISTS `bookingtable3`; CREATE TABLE bookingtable3 ( baynumber tinyint(2) NOT NULL auto_increment, 08:00 - 09:00 varchar(30) NOT NULL default '', 09:00 - 10:00 varchar(30) NOT NULL default '', 10:00 - 11:00 varchar(30) NOT NULL default '', 11:00 - 12:00 varchar(30) NOT NULL default '', 12:00 - 13:00 varchar(30) NOT NULL default '', 13:00 - 14:00 varchar(30) NOT NULL default '', 14:00 - 15:00 varchar(30) NOT NULL default '', 15:00 - 16:00 varchar(30) NOT NULL default '', 16:00 - 17:00 varchar(30) NOT NULL default '', id smallint(30) NOT NULL default '0', PRIMARY KEY (baynumber) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=20 ; INSERT INTO bookingtable3 VALUES(1, '-', '-', '-', '-', '-', '-', '-', '-', '-', 1); INSERT INTO bookingtable3 VALUES(2, '-', '-', '-', '-', '-', '-', '-', '-', '-', 2); INSERT INTO bookingtable3 VALUES(3, '-', '-', '-', '-', '-', '-', '-', '-', '-', 3); INSERT INTO bookingtable3 VALUES(4, '-', '-', '-', '-', '-', '-', '-', '-', '-', 4); INSERT INTO bookingtable3 VALUES(5, '-', '-', '-', '-', '-', '-', '-', '-', '-', 5); INSERT INTO bookingtable3 VALUES(6, '-', '-', '-', '-', '-', '-', '-', '-', '-', 6); INSERT INTO bookingtable3 VALUES(7, '-', '-', '-', '-', '-', '-', '-', '-', '-', 7); INSERT INTO bookingtable3 VALUES(8, '-', '-', '-', '-', '-', '-', '-', '-', '-', ; INSERT INTO bookingtable3 VALUES(9, '-', '-', '-', '-', '-', '-', '-', '-', '-', 9); INSERT INTO bookingtable3 VALUES(10, '-', '-', '-', '-', '-', '-', '-', '-', '-', 10); INSERT INTO bookingtable3 VALUES(11, '-', '-', '-', '-', '-', '-', '-', '-', '-', 11); INSERT INTO bookingtable3 VALUES(12, '-', '-', '-', '-', '-', '-', '-', '-', '-', 12); INSERT INTO bookingtable3 VALUES(13, '-', '-', '-', '-', '-', '-', '-', '-', '-', 13); INSERT INTO bookingtable3 VALUES(14, '-', '-', '-', '-', '-', '-', '-', '-', '-', 14); INSERT INTO bookingtable3 VALUES(15, '-', '-', '-', '-', '-', '-', '-', '-', '-', 15); INSERT INTO bookingtable3 VALUES(16, '-', '-', '-', '-', '-', '-', '-', '-', '-', 16); INSERT INTO bookingtable3 VALUES(17, '-', '-', '-', '-', '-', '-', '-', '-', '-', 17); INSERT INTO bookingtable3 VALUES(18, '-', '-', '-', '-', '-', '-', '-', '-', '-', 18); INSERT INTO bookingtable3 VALUES(19, '-', '-', '-', '-', '-', '-', '-', '-', '-', 19); ") Most of the '-' would have names there, but i removed them. Quote Link to comment Share on other sites More sharing options...
fenway Posted April 21, 2008 Share Posted April 21, 2008 Um, yeah... a few things: 1) you really shouldn't be using tinyint for an auto-increment column. 2) you really shouldn't be using those values as column names. 3) to get it to import, you need to enclose any field name with spaces in backticks (like `this`). Quote Link to comment Share on other sites More sharing options...
gluck Posted April 21, 2008 Share Posted April 21, 2008 Read on how to define mysql column names Quote Link to comment Share on other sites More sharing options...
trilbyfish Posted April 28, 2008 Author Share Posted April 28, 2008 I've change the column names, but still get the same error. 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 '; CREATE TABLE 'bookingtable3' ( `baynumber` varchar(20) NOT NULL auto_increme' at line 1 Is the error, and the code is: ("DROP TABLE IF EXISTS bookingtable3; CREATE TABLE 'bookingtable3' ( `baynumber` varchar(20) NOT NULL auto_increment, `eight` varchar(30) NOT NULL default '', `nine` varchar(30) NOT NULL default '', `ten` varchar(30) NOT NULL default '', `eleven` varchar(30) NOT NULL default '', `twelve` varchar(30) NOT NULL default '', `thirteen` varchar(30) NOT NULL default '', `fourteen` varchar(30) NOT NULL default '', `fifteen` varchar(30) NOT NULL default '', `sixteen` varchar(30) NOT NULL default '', `id` smallint(30) NOT NULL default '0', PRIMARY KEY (`baynumber`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=20 ; Edit: ive changed `baynumber` varchar(20) NOT NULL auto_increment, to `baynumber` int(20) NOT NULL auto_increment, but still the same problem Quote Link to comment Share on other sites More sharing options...
fenway Posted April 29, 2008 Share Posted April 29, 2008 AFAIK, you can't run multiple statements at once. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.