Tom Calland Tom Calland - 2 months ago 17
MySQL Question

PhPMyAdmin Error #1064; Syntax Error

I'm trying to put together a MySQL database for a forum, And when I try to make a section table I keep encountering a problem


#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 'TYPE = INNODB' at line 7


Here's the code:

CREATE TABLE sections (
sect_id INT(8) NOT NULL AUTO_INCREMENT,
sect_name VARCHAR(255) NOT NULL,
sect_desc VARCHAR(255) NOT NULL,
UNIQUE INDEX sect_name_unique (sect_name),
PRIMARY KEY (sect_id)
) TYPE=INNODB;

Answer

Use the following query

CREATE TABLE IF NOT EXISTS sections (
  sect_id          INT(8) NOT NULL AUTO_INCREMENT,
sect_name      VARCHAR(255) NOT NULL,
sect_desc     VARCHAR(255) NOT NULL,
UNIQUE INDEX sect_name_unique (sect_name),
PRIMARY KEY (sect_id)
) ENGINE=InnoDB

To mention the type of engine use ENGINE keyword.