3

Not sure what's wrong, just running this in PHP MyAdmin right now. Does anything pop out to you? Thanks.

INSERT INTO order (CustomerID, BillAddr, ShipAddr, Date, Total)   
VALUES ('test', 'test', 'test', '2012-07-02', 22)

Error:

MySQL said: #1064

Structure of order table:

FIELD                TYPE  
OrderID         int(11) auto increment  
CustomerID      varchar(50)  
BillAddr        varchar(200)  
ShipAddr        varchar(200)  
Date            date  
Total           double  

(I leave the OrderID out of the INSERT as it is an auto increment)

EDIT
Same error with this syntax:

SQL query:

INSERT INTO 'order'( CustomerID, BillAddr, ShipAddr, 'Date', Total )
VALUES (
'test', 'test', 'test', '2012-07-02', 22
)
MySQL said: Documentation
#1064 - 
Greg McNulty
  • 1,476
  • 5
  • 28
  • 50

1 Answers1

12

The word Date is a keyword. Try it like this:

INSERT INTO `order` (CustomerID, BillAddr, ShipAddr, `Date`, Total)   
VALUES ('test', 'test', 'test', '2012-07-02', 22)

ETA: And order is also a keyword :)

Eric Petroelje
  • 59,820
  • 9
  • 127
  • 177