0

This is my list of fields:

$fields = "ID, PropertyID, DateAdded, DateUpdated, RegionName, PropertyType, OtherType, SaleType, Condition, Price, CurrencyName, Title, MainImage, Summary, NoOfBeds, NoOfBaths, NoOfReceptionRooms, Floor, FloorSpace, Furnished, Pool, Garden, CoveredArea, MeasureUnit, Parking, DistanceSea, DistanceAirport, DistanceGolf, DetailNotes, FeaturedProperty, Sold, vrTour, Outbuildings";

And for some strange reason I am getting this 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 'Condition, Price, CurrencyName, Title, MainImage, Summary, NoOfBeds, NoOfBaths, ' at line 1

Has anyone ever come accross a problem in the field names, I have ages ago but can't remember how I solved it, and hey, I didn't know about SO then.

Liam Bailey
  • 5,879
  • 3
  • 34
  • 46

3 Answers3

6
Condition

condition is the mysql reserved word use backquote to avoid error

`Condition`

Here is the list of mysql reserved words

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

Shakti Singh
  • 84,385
  • 21
  • 134
  • 153
0

Condition is a reserved keyword in mysql. If you really want to use it as a field name, you have to wrap it in backticks.

Sam Dufel
  • 17,560
  • 3
  • 48
  • 51
0

"Condition" is a MySQL reserved word and such needs to be used in backquotes.

Dalmas
  • 26,409
  • 9
  • 67
  • 80