Search code examples
mysqlsqlmysql-error-1064

Error 1064 in SQL Code


I used the phpMyAdmin form to create a table, i.e. I filled in the fields and it generated the code. The code generated doesn't work, but I can't find the error. Any help would be appreciated.

#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 '( 1 ) NOT NULL DEFAULT  '0',

userEmail VARCHAR( 255 ) NOT NULL ,PRIMARY KEY (' at line 14

Here's the code:

CREATE TABLE members (
userID INT( 9 ) NOT NULL AUTO_INCREMENT ,
userName VARCHAR( 15 ) NOT NULL ,
userPwd VARCHAR( 16 ) NOT NULL ,
userTitle VARCHAR( 4 ) NOT NULL ,
fName VARCHAR( 30 ) NOT NULL ,
lName VARCHAR( 30 ) NOT NULL ,
address VARCHAR( 255 ) NULL ,
dateOfBirth VARCHAR( 10 ) NULL ,
userJob VARCHAR( 15 ) NULL ,
regDate VARCHAR( 20 ) NOT NULL ,
accType CHAR( 1 ) NOT NULL DEFAULT  'F',
regCode VARCHAR( 255 ) NOT NULL ,
isActivated BOOL( 1 ) NOT NULL DEFAULT  '0',
userEmail VARCHAR( 255 ) NOT NULL ,
PRIMARY KEY (  userID ) ,
UNIQUE (userName ,userEmail)
) ENGINE = MYISAM

mysql ver 5.1 php ver 5.2.*


Solution

  • Change isActivated BOOL( 1 ) NOT NULL DEFAULT '0',

    to

    isActivated BOOL NOT NULL DEFAULT '0',

    you can read about it more : here

    M indicates the maximum display width for integer types

    Bool does not have this so you can't specify width. it's always 1