Persistent Error when Attempting to Create Table

Doubleplay 24 Oct, 2014
I am about as big a noob as there is. But I am stubborn and I am not giving up.

I have created a form for Joomla using Chronoforms5. When I go to create the table and save it, I keep getting an error message as follows, and it resets:

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 'NOT NULL, `PersonalStatement` VARCHAR NOT NULL, PRIMARY KEY (`PersonalStatement`' at line 42 SQL=CREATE TABLE IF NOT EXISTS `Playerinfo` ( `id` INT(11) NOT NULL auto_increment, `uniq_id` VARCHAR(50) NOT NULL, `user_id` INT(11) NOT NULL, `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', `modified` DATETIME NOT NULL, `FirstName` VARCHAR(12) NOT NULL, `LastName` VARCHAR(20) NOT NULL, `Address` VARCHAR(75) NOT NULL, `City` VARCHAR(50) NOT NULL, `State` VARCHAR(30) NOT NULL, `Zip` SMALLINT(15) NOT NULL, `HighSchool` VARCHAR(40) NOT NULL, `Phone` INT(12) NOT NULL, `GradYear` INT(6) NOT NULL, `Email` VARCHAR(75) NOT NULL, `Coach` VARCHAR(25) NOT NULL, `SchoolAddress` VARCHAR(50) NOT NULL, `CoachEmail` VARCHAR(75) NOT NULL, `Positions` VARCHAR(10) NOT NULL, `Height` VARCHAR(6) NOT NULL, `Weight` VARCHAR(4) NOT NULL, `BatsLorR` VARCHAR(3) NOT NULL, `ThrowsLorR` VARCHAR(3) NOT NULL, `INFVELO` SMALLINT(5) NOT NULL, `OFVELO` SMALLINT(5) NOT NULL, `FastballVELO` SMALLINT(5) NOT NULL, `BreakingBallVELO` SMALLINT(5) NOT NULL, `ChangeUpVELO` SMALLINT(5) NOT NULL, `Baserunning1b` DECIMAL(5) NOT NULL, `Baserunning2b` DECIMAL(5) NOT NULL, `Speed60yd` DECIMAL(5) NOT NULL, `Pop` DECIMAL(5) NOT NULL, `Verifiedinfo` VARCHAR(5) NOT NULL, `GPA` DECIMAL(5) NOT NULL, `testscores` SMALLINT(6) NOT NULL, `testscore2` SMALLINT(6) NOT NULL, `interests` VARCHAR(75) NOT NULL, `Awards` VARCHAR(100) NOT NULL, `OtherSports` VARCHAR(50) NOT NULL, `collegeinterest` VARCHAR(100) NOT NULL, `CollegeInterest` VARCHAR NOT NULL, `PersonalStatement` VARCHAR NOT NULL, PRIMARY KEY (`PersonalStatement`) ) DEFAULT CHARSET=utf8;

HELP
Max_admin 24 Oct, 2014
1 Likes
Hi Doubleplay,

Please add a length for the field, like 50 or 200

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 24 Oct, 2014
1 Likes
Hi DoublePlay,

Max is referring to this columns I think
`CollegeInterest` VARCHAR NOT NULL, `PersonalStatement` VARCHAR NOT NULL, 


Also you have set `PersonalStatement` as the PRIMARY KEY instead of `id` - I think that was probably a mistake. The Primary Key needs to be an auto-incrementing integer column.

ob
Doubleplay 24 Oct, 2014
Ok. These are helpful. Bob -- I didn't set the primary key. The form wizard set it. How do I move it? I don't see an obvious way of doing that, although I confess I don't see a lot at this stage of things --

Thanks fellas!
GreyHead 24 Oct, 2014
Hi Doubleplay,

In the Create table there is a Column header Primary. Make sure that the checkmark stays in the first row - the id* column.

If you add VARCHAR columns make sure that you have a number in the Length column.

Bob

* Personally I'd change the name of this column to cf_id to avoid possible problems with the article ID if you put forms in articles.
This topic is locked and no more replies can be posted.