Saturday 25 November 2017

MySQL syntax error in the CREATE TABLE statement

SQL
query:



CREATE TABLE
`comment_threads` (
`comment_id` INT( 11 ) UNSIGNED NOT NULL DEFAULT
'0',
`updated` TIMESTAMP NOT NULL ,
`timestamp` TIMESTAMP NOT NULL
,
) ENGINE = MYISAM
;


This is an old file
that I'm trying to run on HostGator through phpMyAdmin. I get an error that
says:






MySQL said: #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 ')
ENGINE=MyISAM' at line
5




UPDATE:
If
I change the statement to this, I still get an
error:



CREATE TABLE
comment_threads (
comment_id INT( 11 ) UNSIGNED NOT NULL DEFAULT
'0',

updated TIMESTAMP( 14 ) NOT NULL ,
timestamp
TIMESTAMP NOT NULL
PRIMARY KEY ( comment_id ) )
ENGINE = MYISAM
;


I get the
error:




ERROR 1064
(42000): 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 '( 14 ) NOT NULL
,

timestamp TIMESTAMP NOT NULL
PRIMARY KEY ( comment_id
) )
ENGI' at line 3


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...