I'm having some real trouble running some basic queries that I should be able to run easily.
I have a table called settings. When I query SELECT * FROM settings
I get the output:
+----+-----------------+--------------------------------+
| ID | key | value |
+----+-----------------+--------------------------------+
| 1 | view | default |
| 2 | sitename | value! |
| 3 | siteurl | |
| 4 | captcha.enabled | 0 |
| 5 | upload_path | http://web/uploads |
+----+-----------------+--------------------------------+
However, when I then run the simply query SELECT key FROM settings WHERE ID > 0
I get an 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 'key from settings where ID > 0' at line 1
mysql>"
If I wrap key
in single quotes, to make: SELECT 'key' FROM settings WHERE ID > 0
I get:
+-----+
| key |
+-----+
| key |
| key |
| key |
| key |
| key |
+-----+
So for the life of me I cannot understand why mySQL won't recognise the column name! The same thing happens for every column name as well, not just key.
If anyone knows what's going on here please let me know.