Errant_Shadow Posted May 9, 2009 Share Posted May 9, 2009 Using MySQL 5.0.45 the SQL query... CREATE TABLE $TrackName ( segment_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Primary Key. Auto Inremented Index.', length TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'The length of the segment.', condition ENUM('grass', 'rocks', 'dirt', 'mud', 'snow') NOT NULL COMMENT 'What the segment is made of.', hazard ENUM('corner', 'hill', 'jump', 'cliff', 'ice', 'debris') NOT NULL COMMENT 'What is on the segment.', PRIMARY KEY (segment_id), ) ENGINE = MYISAM; returns... Failed to execute SQL : SQL [query] failed : 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 'condition ENUM('grass', 'rocks', 'dirt', 'mud', 'snow') NOT NULL COMMENT 'W' at line 1 I've looked through manuals, but I can't figure out what I've done wrong. Any advice? Quote Link to comment Share on other sites More sharing options...
Errant_Shadow Posted May 9, 2009 Author Share Posted May 9, 2009 Anyone? As far as I can find, the syntax is: field_name ENUM('a', 'b', 'c') [NULL | NOT NULL] [DEFAULT default_value] [etc] I thought it was the default that was messing it up, but even after I took that out, it's still failing. Quote Link to comment Share on other sites More sharing options...
Errant_Shadow Posted May 9, 2009 Author Share Posted May 9, 2009 Is there even an error as far as anyone can see? Maybe the problem is with the server, and not me... Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted May 9, 2009 Share Posted May 9, 2009 Your problem is that condition is a reserved word. You'd be best changing the name of the field, though you could place it in backticks (`) Quote Link to comment Share on other sites More sharing options...
Errant_Shadow Posted May 10, 2009 Author Share Posted May 10, 2009 *sighs* Hopefully next time I'll remember to check reserved words >< Thank you very much, GingerRobot. 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.