USING “RESERVED” MYSQL WORDS FOR FIELD NAMES - Mar 24th, 2015


A number of field names are “reserved” words in the MySQL world. If you use one of them by mistake, you may get a
MySQL error similar to:

MySQL 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...

It’s a pretty long list , and you can find it at:

http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html

If you must use one of those words as a field name, Dave Edis from Interactive Tools has a suggestion. He says, '' A
trick for dealing with those is either renaming the field -or- surrounding it with `backticks` (beside the 1 on most
keyboards). Since ''show'' is a reserved word, you’d surround it with backticks like this:



'where' => 'active ="1"' . ' AND `show` ="1" ',


Backticks are a way of telling MySQL that you mean a table or fieldname and not anything else.

Most of the time it's just easier to rename the field, though. :)''



The materials on this web site have been created for use with CMS Builder content management software. CMS Builder software is published and licensed for use by InteractiveTools.com. Please contact Interactive Tools for information on the downloading of the software or the purchasing of licenses.


Terms of Service