csamuels Posted November 30, 2005 Share Posted November 30, 2005 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' Quote Link to comment https://forums.phpfreaks.com/topic/2963-sql-insert-into-syntax-errors-1064/ Share on other sites More sharing options...
ryanlwh Posted November 30, 2005 Share Posted November 30, 2005 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. Quote Link to comment https://forums.phpfreaks.com/topic/2963-sql-insert-into-syntax-errors-1064/#findComment-9965 Share on other sites More sharing options...
csamuels Posted November 30, 2005 Author Share Posted November 30, 2005 after changing the column names it works. thank you Quote Link to comment https://forums.phpfreaks.com/topic/2963-sql-insert-into-syntax-errors-1064/#findComment-9968 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.