Forum Moderators: open
#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 'UNSIGNED DEFAULT '0' NOT NULL AUTO_INCREMENT, `lastName` VARCHAR(30) DEFAULT '0'' at line 1
CREATE TABLE `guestLog` (
`firstName` VARCHAR( 30 ) UNSIGNED DEFAULT '0' NOT NULL AUTO_INCREMENT ,
`lastName` VARCHAR( 30 ) DEFAULT '0' NOT NULL ,
`email` VARCHAR( 60 ) UNSIGNED DEFAULT '0' NOT NULL ,
`phone` VARCHAR( 10 ) UNSIGNED DEFAULT '0' NOT NULL ,
`userID` VARCHAR( 20 ) DEFAULT '0' NOT NULL ,
`passWord` VARCHAR( 10 ) DEFAULT '0' NOT NULL ,
`excerpt` VARCHAR( 1000 ) ,
`city` VARCHAR( 60 ) ,
`state` VARCHAR( 2 ) ,
`webSite` VARCHAR( 60 ) ,
`career` VARCHAR( 60 ) ,
PRIMARY KEY ( `userID` )
) TYPE = MYISAM
CREATE TABLE `guestLog` (
`firstName` VARCHAR( 30 ),
`lastName` VARCHAR( 30 ),
`email` VARCHAR( 60 ),
`phone` VARCHAR( 10 ),
`userID` INTEGER NOT NULL AUTO_INCREMENT,
`passWord` VARCHAR( 10 ),
`excerpt` TEXT,
`city` VARCHAR( 60 ),
`state` VARCHAR( 2 ),
`webSite` VARCHAR( 60 ),
`career` VARCHAR( 60 ),
PRIMARY KEY ( `userID` )
) TYPE = MYISAM
It's a simplified version of what you started out with, feel free to add in NOT NULL and DEFAULT as appropriate for your fields.
I've removed the UNSIGNED's from the VARCHAR (text) fields because UNSIGNED is a keyword for numeric fields, I've removed the DEFAULT('0') because on the whole they didn't seem to be using appropriate or useful defaults.
Lastly I've moved your AUTO_INCREMENT from firstName to userID, then changed userID to an INTEGER (numeric) before making it the primary key. This should give you an automatically-generated unique numeric key for each record entered, which is what a userID / primary key should generally be.
Also changed excerpt to TEXT rather than VARCHAR(1000) because VARCHAR is limited to 255 characters in the existing mySQL engines, the db would have worked around it but figured might as well keep the example tidy.
- Tony
I will give it shot when I get home tonight, and let you know how it came out. Also, I will soon be posting a discussion on how to define a forum data type. I haven't even got that far yet (and it may be a week or two), but I know I am going to have problems. Thanks for all your help.
Mitchell