Jump to content

Recommended Posts

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

 

 

 

[!--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

 

 

 

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'

Link to comment
https://forums.phpfreaks.com/topic/2963-sql-insert-into-syntax-errors-1064/
Share on other sites

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.