Jump to content


Photo

sql insert into syntax errors 1064


  • Please log in to reply
2 replies to this topic

#1 csamuels

csamuels
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 30 November 2005 - 10:07 PM

i don't understand why im getting these syntax errors


index column is varchar(100)
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
Error running query
insert into persinfo set agtname='agtname',keyperson='key person1',title='title',hiredate='01-01-2005',yearsinforce='50',prof_desg='prof desg',lic_num='12345-1245',index='12a538f190e79b6f3806965c93318bc1'

1064: 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 'index='12a538f190e79b6f3806965c93318bc1'' at line 1
[/quote]



[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
Error running query
insert into automation set manage_sys='1',manage_name='vendor',purchased='01-01-2005',software='software name',version='version',functions='accounting,word processing,Sales Aids,client policy information,applications,claims,rate/quote,other,',functions_other='other reason',if='1',if_reason='pl,cl,claims/other,auto,bop,ho,contractors,umb,smp,commerical umbrella,',if_function='if reason',commitment='commit',if_percent='20%',auto_manager='1',auto_who='auto reason',auto_who1='auto who',agtname='agtname'

1064: 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 'if='1',if_reason='pl,cl,claims/other,auto,bop,ho,contractors,umb,smp,commerical ' at line 1
[/quote]



but these do execute
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
query executed
insert into info set agtname='agtname',mail_address='mail address',mail_county='mail county',mail_city='mail city',mail_state='mail state',mail_zip='12452-4521',phone='phone',fax='fax',fedid='12345-1245',email='email',phy_address='phy address',phy_county='phy county',phy_city='phy city',phy_state='phy state'

query executed
insert into principals set agtname='agtname',name='prince name',title='title',dob='06/26/83',yearsagy='200'
[/quote]

#2 ryanlwh

ryanlwh
  • Staff Alumni
  • Advanced Member
  • 511 posts

Posted 30 November 2005 - 11:03 PM

index and if are reserved words of mysql. you can get away with using some reserved words as column names like 'date', but most other reserved words are not being parsed correctly when used as column names. backtick them: `index`='value' `if`='value' or avoid using reserved words as column names.
Please use EDIT * 100...
Please use
or [php] * 1000...

PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...

#3 csamuels

csamuels
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 30 November 2005 - 11:54 PM

after changing the column names it works. thank you




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users