Jump to content

Errors....................


jwk811

Recommended Posts

I'm trying to create this table on my database.

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.
Link to comment
Share on other sites

The error was:

#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 'user_level `` ENUM(('0','1','2','3') ) NOT NULL DEFAULT '''0'''

Now what is that about the syntax. Do you know what that means? It there something wrong with my whole set up. I tried to change the ENUM thing you were talking about but there was no change, unless I'm doing it wrong.

How can I put an image up here? I want to show you my screen shot of what I am doing.
Link to comment
Share on other sites

If you are using ENUM you enter this into the textbox exactly
'0','1','2','3'

You dont enter
('0','1','2','3')

Thats what the problem is.

Also you still havnt used any compression on your images! When posting images to the web save as gif or a jpeg never a bmp. Thats why I edited your post in the first place. otherwise it takes ages for the page to load for others. I have compresed the images for you now.
Link to comment
Share on other sites

Thank you I guess that was the problem. BUT, after that and I tried to save it I got a new error. Error #1166. Hears what it says. (I hope this one is an easy one to fix)

#1166 - Incorrect column name 'userid '

What does that one mean? How will I fix that. I'm really happy I got past that other problem but of course something else has to happen wrong. I have it set up the same way as the picture up top exept I fixed the problem with the ENUM like you said.

The manual doesn't help. So, I don't know what to do. Please help.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.