By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,156 Members | 1,071 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,156 IT Pros & Developers. It's quick & easy.

Why am I getting a MySQLi Syntax error?

Samishii23
100+
P: 246
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 'desc) VALUES (?,?)' at line 1
Syntax:
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO equip_type (name, desc) VALUES (?,?)
Other Syntax on my program that works:
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO equipment (name,purchasedate,purchaseprice,type,lastrepair,serial,usagetype,usageval,brand,dateadded,notes) VALUES (?,?,?,?,?,?,?,?,?,?,?)
I can't see the problem... Any help?
May 12 '11 #1

✓ answered by JKing

Throw some back ticks around desc and try again. DESC is a reserved word.

Here is a link if you want some more information on reserved words/keywords in mysql: MySQL Reserved Words

Share this Question
Share on Google+
3 Replies


JKing
Expert 100+
P: 1,206
Throw some back ticks around desc and try again. DESC is a reserved word.

Here is a link if you want some more information on reserved words/keywords in mysql: MySQL Reserved Words
May 13 '11 #2

P: 47
you have to check your spelling and desc table again .. make sure everything is correct spelling in table's structure
Jun 9 '11 #3

P: 4
Second statement is fine.. First having issue because you are using "desc" as column name. It is not possible as "desc" is reserved key word for sorting a column.. create table that having column name as "name" and "description". Then insert into that.. :)
Aug 23 '13 #4

Post your reply

Sign in to post your reply or Sign up for a free account.