FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


mySQL issue





X3 Talk
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.
Rhysige
$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?
muggle
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.
X3 Talk
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.
X3 Talk
Correct, it doesn't like describe. Problem fixed. Thanks.
the zephyrus
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.
X3 Talk
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.
Related topics
MYSQL import problems
[MySQL] Client does not support authentication protocol
SQL error on my site
Error connecting to mysql ; please help
mySQL doesn't see a table that IS THERE
Datalog
Problem with NAVICAT 8 for mysql
Make MySQL value Increase by one, using PHP
Me have this issue long time! :)
MySQL Timeout
General error - mysql server has gone away.
i also resolved the issue of openvpn+freeradius+mysql
PHP and Javascript Issue handling data from a mysql query
Server 4 Down
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.