nathaliamota Posted December 2, 2008 Share Posted December 2, 2008 I have the following table in a mysql database: CREATE TABLE IF NOT EXISTS `CASE` ( `CASE_NUM` bigint(20) unsigned NOT NULL auto_increment, `DATE` timestamp NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `PERSON_ID` int(11) NOT NULL, `RESIDENCY_DETAILS_ID` int(11) NOT NULL, `MORT_COMP_ID` int(11) NOT NULL, `LOAN_ID` int(11) NOT NULL, `INTAKE_REPRE_ID` int(11) default NULL, `COUNSELOR_ID` int(11) default NULL, PRIMARY KEY (`CASE_NUM`), UNIQUE KEY `PERSON_ID` (`PERSON_ID`), UNIQUE KEY `RESIDENCY_DETAILS_ID` (`RESIDENCY_DETAILS_ID`), UNIQUE KEY `LOAN_ID` (`LOAN_ID`), KEY `INTAKE_REPRE_ID` (`INTAKE_REPRE_ID`), KEY `COUNSELOR_ID` (`COUNSELOR_ID`), KEY `MORT_COMP_ID` (`MORT_COMP_ID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; And I am trying to insert data to it. I have tried all of the following pieces of SQL code: insert into CASE (PERSON_ID, RESIDENCY_DETAILS_ID, MORT_COMP_ID, LOAN_ID, INTAKE_REPRE_ID, COUNSELOR_ID) values (1, 2, 3, 4, 5, 6); insert into CASE (PERSON_ID, RESIDENCY_DETAILS_ID, MORT_COMP_ID, LOAN_ID) values (1, 2, 3, 4); insert into CASE (DATE, PERSON_ID, RESIDENCY_DETAILS_ID, MORT_COMP_ID, LOAN_ID, INTAKE_REPRE_ID, COUNSELOR_ID) values ("2003-12-31 01:02:03", 1, 2, 3, 4, 5, 6); None of them work! They all generate a syntax error. Can anyone help me figure out what is wrong with it? Thank you Quote Link to comment https://forums.phpfreaks.com/topic/135234-sql-syntax-error/ Share on other sites More sharing options...
Mchl Posted December 2, 2008 Share Posted December 2, 2008 CASE is mysql reserved word If you really need to call your table like that, enclose it's name in `` in all queries. Better rename it. Quote Link to comment https://forums.phpfreaks.com/topic/135234-sql-syntax-error/#findComment-704395 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.