Skip to content
Advertisement

Why am I getting an error in this create table script? [closed]

I’m attempting to write my first php/mysql page and am running into a SQL syntax error I can’t find the cause of.

The error is as following:

Unable to create domain suggestions table. Error 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 ‘PRIMARY_KEY, domain TEXT, author TEXT, submitdate DATE NOT NULL ) DE’ at line 2

Advertisement

Answer

In your CREATE TABLE statement, it should be PRIMARY KEY with a space instead of PRIMARY_KEY that contains an underscore.

Solution:

Remove the underscore from PRIMARY_KEY.

Corrected script:

Demo:

Click here to view the working CREATE TABLE script in SQL Fiddle.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement