INSERT INTO items (item, type, cost, img, describe)
VALUES ('Coaster', 'Electronics', '$499', 'coaster.jpg', 'This coaster is more than a coaster. It sings to you when you place a drink on it. It also features up to the minute live feeds on the stock market and news updates.')
I believe that the table is formatted right, but mySQL says I have a syntax error.
Help will be rewarded.
$499 I think may be the problem.. $ means it will be reading it as a PHP variable wont it?
Also why not just make that a currency field and input 499?
The reason might be because `describe` is a reserved word. According to MySQL documentation you might use reserved words as identifiers if you quote them.
Anyway I don't think it's a good idea.
You can check for more reserved words here:
http://dev.mysql.com/doc/refman/4.1/en/reserved-words.html
http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html
For more specific answer, related to your problem, please post the table definition and the exact error message you're getting.
The error:
Error: 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 'describe) VALUES ('Fridge', 'Whitegoods', '$3999', 'fri' at line 1. I got slightly confused by the manual.
Correct, it doesn't like describe. Problem fixed. Thanks.
Do backslash escape the dollar sign though, as a matter of habit. Not doing so can be risky. Unless your query was originally in single quotes, in which case dollar signs are ignored and you're fine.
No, actually it is sent through a POST variable.
Also, in case you use a different currency like Euro, Pounds Sterling and the list goes on.
Thanks.