468,512 Members | 1,538 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,512 developers. It's quick & easy.

Why am I getting a MySQLi Syntax error?

Samishii23
246 100+
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

3 2070
JKing
1,206 Expert 1GB
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
Wiinie
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
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.

Similar topics

reply views Thread by Reestit Mutton | last post: by
26 posts views Thread by Dodger | last post: by
12 posts views Thread by davids58 | last post: by
2 posts views Thread by Curtis | last post: by
13 posts views Thread by Schmidty | last post: by
21 posts views Thread by Daz | last post: by
2 posts views Thread by Michael | last post: by
2 posts views Thread by Taras_96 | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.