Forum Moderators: coopster
My web hosting company offers a service in the control panel that automatically creates a table when I fill in the information but it keeps giving me the same error.
There are 3 fields:
Field, Length/Values, and Default
There are 4 drop down menus:
Type, Attributes, Null, and Extra
And there are 5 radio buttons:
Primary, Index, Unique, ---, and Fulltext
I can only choose 1 out of the 5 radio buttons and --- is selected by default. As for the drop down menus, for Type there is 25 variable types to choose from. For Attributes I can leave it blank or choose BINARY, UNSIGNED, or UNSIGNED ZEROFILL. For Null, I can either choose NULL or NOT NULL and for Extra I can either leave it blank or choose auto_increment.
Based on that, can someone give me directions on how to create a valid table by telling me what to type in the fields, what to select from the drop down menus and which radio button to select?
Here is a table I created.
CREATE TABLE `Business` ( `Name` TEXT( 55 ) NOT NULL
) COMMENT = 'Why won't it work?'
And here is the error message:
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 '(55) NOT NULL) COMMENT = 'Why won't it work?'' at line 1 My web hosting company uses mySQL 4. Thanks for any help. I'll keep reading through the mySQL 4 manual in the meantime.
The problem with the SQL that your are currently trying to execute is that you are specifying 50 for the length of the text. If you change that field to a VARCHAR field, everything works fine. A VARCHAR field can contain upto 255 characters, so 50 is not a problem.
When I excecuted the folowing, everything worked fine.
CREATE TABLE `Business` (`Name` VARCHAR( 50 ) NOT NULL
) COMMENT = 'Why wont it work?';
Note that I have changed the field type to VARCHAR in the statement! ;)
Field, Length/Values, and Default
Type, Attributes, Null, and Extra
Primary, Index, Unique, ---, and Fulltext
For more information, you may want to check out: [mysql.com...]
If you try to create a table, and have problems, paste here your sql and someone can take a look to see why it doesn't work.
Regards,
wruk999