-1

so im trying to get a dynamicly generated sql query to update these lines but i keep getting an error. and i cant really understand whats wrong with it.

so.. got any clues?

Query:

 UPDATE abilities
 SET STR=8, DEX=8, CON=8, INT=8, WIS=8, CHA=8, Points=0 
 WHERE ID=1

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 'INT=8, WIS=8, CHA=8, Points=0 WHERE 
ID=1' at line 2
Dharman
  • 30,962
  • 25
  • 85
  • 135
  • I see this type of question all the time, please read [common database debugging for PHP and MySQL](http://jason.pureconcepts.net/2013/04/common-debugging-php-mysql/). – Jason McCreary May 22 '14 at 20:41

2 Answers2

3

INT is a reserved key word and you need to backtick it

`INT`

Checkout the complete list here http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html

Abhik Chakraborty
  • 44,654
  • 6
  • 52
  • 63
3

Try adding backticks around the field INT.

UPDATE abilities
 SET STR=8, DEX=8, CON=8, `INT`=8, WIS=8, CHA=8, Points=0 
 WHERE ID=1

INT is a reserved word in MySQL.

Jason McCreary
  • 71,546
  • 23
  • 135
  • 174
Robbert
  • 6,481
  • 5
  • 35
  • 61