Jump to content

[SOLVED] SQL N00b with syntax issues


FlashbackJon

Recommended Posts

I'm working from a few tutorials at once and trying to customize to my purposes while I do so.  That's probably not the best solution, but I was pretty confident until I reached the first step and got hit in the groin.

 

I'm trying to run the following SQL command on my existing MySQL 4.0.25 database via the php_my_admin 2.6.4-pl4 interface:

 

CREATE TABLE fc_user (
userID int(10) UNSIGNED NOT NULL auto_increment PRIMARY,
userName varchar(15) NOT NULL UNIQUE,
encryptPass varchar(32) NOT NULL,
userPass varchar(15) NOT NULL,
userDisplayName varchar(250) NOT NULL,
userEmail varchar(100) NOT NULL,
userSignupDate datetime NOT NULL default="now()",
userLocation varchar(100),
userTimeZoneOffset varchar(4) default="-6",
userWebsite varchar(250) default="http://",
userAIM varchar(100),
userMSN varchar(100),
userYahoo varchar(100),
userICQ varchar(100),
userSkype varchar(100),

PRIMARY KEY (userID)
);

 

It keeps firing back with the following error:

MySQL said: Documentation

#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 '

userName varchar(15) NOT NULL UNIQUE,

encryptPass varchar(32

I've tried removing the "unique", removing the field declaration itself, fiddling in every way I can think of but I seriously cannot figure out what's wrong with it.  It just selects the text starting at that line regardless.

 

Thoughts and patience for a n00b?

Link to comment
Share on other sites

The addition of "KEY" fixed the first problem.  Removing the equal signs also killed some errors.

 

Then the datetime field started causing issues, I looked into it, trying about a dozen different options.  Turns out default can't be set as a function (now()) and my host is using an older version of MySQL, so timestamps operate funny.

 

Anyhow, I got it to work, if not ideally yet.  :)

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.