[SOLVED] mySQL Error #1064 - SQL syntax

Getting this error:

#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 ‘‘tbl_project_user_assignment’ ( ‘project_id’ Int(11) NOT NULL, ‘user_id’ Int(11)’ at line 1

When trying to import this SQL statement using phpMyAdmin and mySQL





CREATE TABLE IF NOT EXISTS 'tbl_project_user_assignment'

(

'project_id' Int(11) NOT NULL,

'user_id' Int(11) NOT NULL,

'create_time' DATETIME,

'create_user_id' INTEGER,

'update_time' DATETIME,

'update_user_id' INTEGER,

PRIMARY KEY ('project_id','user_id')

) ENGINE = InnoDB

;




What worked for me is to change the single quotes to back quotes like below:





CREATE TABLE IF NOT EXISTS `tbl_project_user_assignment`

(

`project_id` Int(11) NOT NULL,

`user_id` Int(11) NOT NULL,

`create_time` DATETIME,

`create_user_id` INTEGER,

`update_time` DATETIME,

`update_user_id` INTEGER,

PRIMARY KEY (`project_id`,`user_id`)

) ENGINE = InnoDB

;




I don’t know why this worked, but it did

This is my environment:

MySQL

  • Server: localhost via TCP/IP
  • Server version: 5.5.16
  • Protocol version: 10
  • User: root@localhost
  •     MySQL charset:                    UTF-8 Unicode            (utf8)
    

Web server

  • Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1
  • MySQL client version: mysqlnd 5.0.8-dev - 20102224 - $Revision: 310735 $
  • PHP extension: mysql

phpMyAdmin

  • Version information: 3.4.5, latest stable version: 3.4.6