acctman
acctman

Reputation: 4349

mysql error 1064 when inserting

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 '(country,ping,order) VALUES (China,1,1)' at line 1

this is my code

INSERT INTO  
  (country, ping, order) 
VALUES 
  ('China', '1', '1');

Upvotes: 0

Views: 6019

Answers (4)

OV Web Solutions
OV Web Solutions

Reputation: 825

You're missing the Table Name. Try:

INSERT INTO MYTABLENAME (country,ping,order) VALUES ('China','1','1');

Upvotes: 2

JOE SKEET
JOE SKEET

Reputation: 8118

you are missing table name. also make sure that those quotes are necessary

Upvotes: 0

Ike Walker
Ike Walker

Reputation: 65587

Your insert statement is missing the table name:

INSERT INTO tbl_name (col_name,...) VALUES (expr,...)

Upvotes: 2

Leslie
Leslie

Reputation: 3644

are ping and order text fields or numeric? if numeric remove the ticks from the 1's

INSERT INTO Tablename (country,ping,order) VALUES ('China',1,1)

could also be reserved word try:

INSERT INTO Tablename (country,`ping`,`order`) VALUES ('China',1,1)

Upvotes: 2

Related Questions