FlashbackJon Posted April 17, 2007 Share Posted April 17, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/47346-solved-sql-n00b-with-syntax-issues/ Share on other sites More sharing options...
bubblegum.anarchy Posted April 17, 2007 Share Posted April 17, 2007 have you tried removing PRIMARY or adding the word KEY and consider changing userSignupDate datetime NOT NULL default="now()", to userSignupDate timestamp NOT NULL default timestamp, remove all the = signs and define the primary key either in the column definition or the statement footer Quote Link to comment https://forums.phpfreaks.com/topic/47346-solved-sql-n00b-with-syntax-issues/#findComment-231001 Share on other sites More sharing options...
FlashbackJon Posted April 18, 2007 Author Share Posted April 18, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/47346-solved-sql-n00b-with-syntax-issues/#findComment-232169 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.