Seerex
Seerex

Reputation: 601

MySQL query gone wrong?

another query gone wrong!

I am trying to INSERT INTO anretOrders (order, orderNumber) VALUES ('test', 15)

Now, the anretOrders table has 3 columns, but one is the id so i am leaving that out since it auto-increments. The other is "order" which is a text column, and orderNumber which is an int.

I cannot, for the life of me, figure out what is wrong here? what am i missing?

Upvotes: 0

Views: 47

Answers (2)

Nagaraj S
Nagaraj S

Reputation: 13484

order is a Reserved Words

So try like this

create table anretOrders (`order` varchar(20),orderNumber int);

INSERT INTO anretOrders (`order`, `orderNumber`) VALUES ('test', 15)

Sql FIDDLE

Upvotes: 0

Nouphal.M
Nouphal.M

Reputation: 6344

escape the field names since order is a keyword in mysql

INSERT INTO anretOrders (`order`, `orderNumber`) VALUES ('test', 15)

Upvotes: 4

Related Questions