Jump to content

Archived

This topic is now archived and is closed to further replies.

jwk811

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

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.

Share this post


Link to post
Share on other sites
If you are using enum it should be this:
[code]`user_level ` ENUM('0','1','2','3') NOT NULL DEFAULT '0',[/code]

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
[IMG]http://i45.photobucket.com/albums/f59/wildteen88/table2.gif[/img]
[IMG]http://i45.photobucket.com/albums/f59/wildteen88/error2.gif[/img]

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
I have fixed this problem. Thank you very much for the people that helped me. Now I went to the next step on this tutorial and am having problems again, what a suprise. I have that post out with that problem.  :-\

Share this post


Link to post
Share on other sites

×

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.