The database language MySQL has a number of reserved words that should not be used in queries or for field names. Some of the big ones are:
- Add
- All
- Between
- Both
- Check
- Current_Date
- Drop
- For
- From
- Group
- INT
- Key
- Load
- Lock
- Null
- On
- Out
- Real
- Repeat
- Table
- Use
- Write
And so it goes. I came across the official list when I couldn’t work out why this query wouldn’t work:
[SQL]SELECT COUNT(id) FROM messages WHERE read = ‘0′ AND to = $logged_in_id[/SQL]
The reason? Both “to” and “read” are reserved words and the query failed. See the full list here:
it’s very impotent to be aware of the reserved words, I built a cms that has a filed in each table called (CONDITION) and now its reserved in mysql 5..
Thanks Steve