Forum Moderators: coopster

Message Too Old, No Replies

Debugging MySQL syntax

I can't figure it out

         

wesg

12:11 am on Dec 20, 2008 (gmt 0)

10+ Year Member



I have a query for a website I'm building, and despite my efforts, I can't get it working. I've used CocoaMySQL to check it, then modify the PHP code, and it doesn't seem to work. Can anyone see a problem?


INSERT INTO details (item_id, detail_name, detail_value, order) VALUES
(41, '****', '1500', 1),
(41, '****', '1 ounce .999 pure silver', 2),
(41, '****', '1988', 3),
(41, '****', 'proof', 4),
(41, '****', '$89.95 CAN', 5),
(41, '****', '****', 6),
(41, '****', '$240', 7),
(41, '****', '$290', 8)

new lines are for organization

This code inserts multiple rows in a single query, simply for speed, and because of the design of my database.

Alcoholico

12:19 am on Dec 20, 2008 (gmt 0)

10+ Year Member



Is item_id always the same? If item_id is defined as the primary key or unique key then it should not be always the same, try using REPLACE INTO instead of INSERT INTO, I can't spot any other issue, apart from the actual content of "*****".

coopster

1:16 pm on Dec 20, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You used "order" as a column name and that is a reserved word [dev.mysql.com] in MySQL.