Jump to content


Photo

Database-Tables Errors


  • This topic is locked This topic is locked
3 replies to this topic

#1 jwk811

jwk811
  • Members
  • PipPipPip
  • Advanced Member
  • 714 posts

Posted 24 August 2006 - 03:45 AM

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!

#2 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 24 August 2006 - 05:16 AM

what version of mysql are you using? i tried your query and it created the table just fine.

p.s.- moving this to the sql forum.
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#3 jwk811

jwk811
  • Members
  • PipPipPip
  • Advanced Member
  • 714 posts

Posted 24 August 2006 - 09:45 PM

I fixed that problem and now have a new error. Error #1166.

#4 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 24 August 2006 - 10:37 PM

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

This will help with your next error - http://helpguide.inm...r-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.
Legend has it that reading the manual never killed anyone.
My site




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users