Jump to content

Recommended Posts

I'm getting an Error code: 1064 when I try to create the following table: It says it is at or near line 6 which is the email field. Any ideas?

Also do I need the last line?

ENGINE=MyISAM DEFAULT CHARSET=utf8;)

 

This was taken from a tutorial that is a couple of years old.

 

I'm using using MySQL Version: 5.1.56

 

 

 

CREATE TABLE IF NOT EXISTS `users` ( 
`id` int(11) NOT NULL auto_increment, 
`username` varchar(32) NOT NULL, 
`password` varchar(32) NOT NULL, 
`online` int(20) NOT NULL default ‘0', 
`email` varchar(100) NOT NULL, 
`active` int(1) NOT NULL default ‘0', 
`rtime` int(20) NOT NULL default ‘0', 
PRIMARY KEY (`id`) 
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

Link to comment
https://forums.phpfreaks.com/topic/253619-help-w-error-code-1064/
Share on other sites

Two things I am seeing, the first is smart quotes in the default fields. Not sure if this is the problem. The second is an int(20). From what I recall, 11 is the max int size. I do not know if that would cause the error or not, but if you need it to be 20 slots, use BIGINT.

 

http://dev.mysql.com/doc/refman/5.0/en/integer-types.html

 

Do that and change those smart quotes and it should work:

 

 CREATE TABLE IF NOT EXISTS `users` ( 
`id` int(11) NOT NULL auto_increment, 
`username` varchar(32) NOT NULL, 
`password` varchar(32) NOT NULL, 
`online` bigint NOT NULL default '0', 
`email` varchar(100) NOT NULL, 
`active` tinyint(1) NOT NULL default '0', 
`rtime` bigint NOT NULL default '0', 
PRIMARY KEY (`id`) 
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

 

See how that goes.

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.