rugzo Posted December 28, 2008 Share Posted December 28, 2008 Hi all, i get the error message below when i submit a form to mysql ---> 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 'Group, Info, Description, Script, TrainingDocuments) values (' ', ' ', ' ', ' at line 1 I don't know which of the values is causing this or even if it is one of them. My table is ---> CREATE TABLE IF NOT EXISTS `subjects` ( `Id` int(10) NOT NULL auto_increment, `Subject` text NOT NULL, `Troubleshoot` text NOT NULL, `Knox` text NOT NULL, `Summary` text NOT NULL, `CTI` text NOT NULL, `Group` text NOT NULL, `Info` text NOT NULL, `Description` text NOT NULL, `Script` text NOT NULL, `TrainingDocuments` text NOT NULL, PRIMARY KEY (`Id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; and my form looks like ---> <?php @mysql_connect ("localhost", "root", "123*qwe123") or die (mysql_error()) ; @mysql_select_db ("kb") or die (mysql_error()) ; $Subject = $_POST["Subject"] ; $Troubleshoot = $_POST["Troubleshoot"] ; $Knox = $_POST["Knox"] ; $Summary = $_POST["Summary"] ; $CTI = $_POST["CTI"] ; $Group = $_POST["Group"] ; $Info = $_POST["Info"] ; $Description = $_POST["Description"] ; $Script = $_POST["Script"] ; $TrainingDocuments = $_POST["TrainingDocuments"] ; if ($Subject <>"") { $sql = "INSERT INTO subjects (Subject, Troubleshoot, Knox, Summary, CTI, Group, Info, Description, Script, TrainingDocuments) values ('$Subject', '$Troubleshoot', '$Knox', '$Summary', '$CTI', '$Group', '$Info', '$Description', '$Script', '$TrainingDocuments') " ; $kayit = mysql_query($sql) ; echo mysql_error() ; } ?> Has someone a Idea. Many thanks... Quote Link to comment https://forums.phpfreaks.com/topic/138635-solved-post-error/ Share on other sites More sharing options...
MadTechie Posted December 28, 2008 Share Posted December 28, 2008 Certain words such as GROUP are reserved and require special treatment for use as identifiers such as table and column names. So to fix this change the field name to somethiing thats not reserved .. (more info) or add back tick ie $sql = "INSERT INTO subjects (Subject, Troubleshoot, Knox, Summary, CTI, `Group`, Info, Description, Script, TrainingDocuments) values ('$Subject', '$Troubleshoot', '$Knox', '$Summary', '$CTI', '$Group', '$Info', '$Description', '$Script', '$TrainingDocuments') " ; Quote Link to comment https://forums.phpfreaks.com/topic/138635-solved-post-error/#findComment-724853 Share on other sites More sharing options...
rugzo Posted December 28, 2008 Author Share Posted December 28, 2008 Thanks, it works now Quote Link to comment https://forums.phpfreaks.com/topic/138635-solved-post-error/#findComment-724857 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.