0

All I am trying to do is create a simple database to store user information they submit off my website. Here is my code:

USE database_1; 

   CREATE TABLE contact_us (
   `id` INT NOT NULL AUTO_INCREMENT,
   `fname` VARCHAR(30) NOT NULL,
   `lname` VARCHAR(30) NOT NULL,
   `coName` VARCHAR(50) NOT NULL,
   `phone` VARCHAR(11) NOT NULL,
   `ext` VARCHAR(10) NOT NULL,
   `street` VARCHAR(50) NOT NULL,
   `city` VARCHAR(30) NOT NULL,
   `state` VARCHAR(30) NOT NULL,
   `zip` VARCHAR(10) NOT NULL,
   `email` VARCHAR(50) NOT NULL,
   `website` VARCHAR(50) NOT NULL,
   `inquiry` VARCHAR NOT NULL,
    PRIMARY KEY(id)
) ENGINE=INNODB;

Here is my error message:

#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, PRIMARY KEY(id) 
) ENGINE=INNODB' at line 14

I have checked/tried to make sure all commas and semicolons were in place, added a space between PRIMARY KEY (id), adding a space between ENGINE = INNODB;, and moving ENGINE=INNODB; down to its own line. I have looked over a ton of forums to see if I could figure it out myself but everything I have tried hasn't resolved my error. If anyone out there as any idea what I am doing wrong, your help would be greatly appreciated. Thank You

2 Answers2

1

replace this

    `inquiry` VARCHAR NOT NULL,

by

   `inquiry` VARCHAR(25) NOT NULL,

you have to give VARCHAR LENGTH, i writed 25 you have to choose your length

echo_Me
  • 37,078
  • 5
  • 58
  • 78
0

Replace

`inquiry` VARCHAR

with

`inquiry` VARCHAR(XX)

where XX is the fixed (max) length of the inquiry field, or with

`inquiry` LONGTEXT

if the inquiry field should store a text of arbitrary length.

Michael
  • 689
  • 9
  • 13
  • Thanks for the information about LONGTEXT. I am still learning about all the different aspects to this language. I will definitely keep that in mind. – mddanielewicz May 24 '14 at 21:24