Jump to content

Database-Tables Errors


jwk811

Recommended Posts

I'm trying to create this table on my database. This table is the exact one on the membership information user tutorial to make user accounts. But it didn't work for me. I kept getting errors.

CREATE TABLE users (
  userid int(25) NOT NULL auto_increment,
  first_name varchar(25) NOT NULL default '',
  last_name varchar(25) NOT NULL default '',
  email_address varchar(25) NOT NULL default '',
  username varchar(25) NOT NULL default '',
  password varchar(255) NOT NULL default '',
  info text NOT NULL,
  user_level enum('0','1','2','3') NOT NULL default '0',
  signup_date datetime NOT NULL default '0000-00-00 00:00:00',
  last_login datetime NOT NULL default '0000-00-00 00:00:00',
  activated enum('0','1') NOT NULL default '0',
  PRIMARY KEY  (userid)
) TYPE=MyISAM COMMENT='Membership Information';


I set it up the best I could. For the PRIMARY KEY (userid) part, I made the userid have the primary key radio... if that was what it was supposed to be.

This is what I put in and the error that came up:

This was the error.
Error
SQL query:
CREATE TABLE `Users` (
`userid` INT( 25 ) NOT NULL DEFAULT '''''' AUTO_INCREMENT PRIMARY KEY ,
`first_name ` VARCHAR( 25 ) NOT NULL DEFAULT '''''',
`last_name ` VARCHAR( 25 ) NOT NULL DEFAULT '''''',
`email_address ` VARCHAR( 25 ) NOT NULL DEFAULT '''''',
`username ` VARCHAR( 25 ) NOT NULL DEFAULT '''''',
`password ` VARCHAR( 25 ) NOT NULL DEFAULT '''''',
`info ` TEXT NOT NULL ,
`user_level ` ENUM( (
'0',
'1',
'2',
'3'
) ) NOT NULL DEFAULT '''0''',
`signup_date ` DATETIME NOT NULL DEFAULT '''0000-00-00 00:00:00''',
`last_login ` DATETIME NOT NULL DEFAULT '''0000-00-00 00:00:00''',
`activated ` ENUM( (
'0',
'1'
) ) NOT NULL DEFAULT '''0'''
) TYPE = MYISAM COMMENT = 'Membership Information'

MySQL said: 
#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 '('0','1','2','3')) NOT NULL DEFAULT '''0''', `signup_date ` DAT
Please help me on this.

And I think that once I fix this error above however I will do that there will be a different problem. If there is I'll reply it to this again. Please help me!
Link to comment
Share on other sites

And when you checked the manual, you found that Error 1166 meant "WRONG_COLUMN_NAME".

This will help with your next error - http://helpguide.inmotionhosting.com/mysql_faq/manual_Error-handling.html

Meantime, if you want someone to help you resolve the problem you'll need to do more than simply state an error number.  The error descriptions are helpful only if you share relevant code and circumstance.

mod edit - closing this thread. You have the same question in another thread.  Please do NOT post the same problem in more than one place/thread.
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.