Jump to content

Recommended Posts

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...

 

 

Link to comment
https://forums.phpfreaks.com/topic/138635-solved-post-error/
Share on other sites

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') " ;

 

Link to comment
https://forums.phpfreaks.com/topic/138635-solved-post-error/#findComment-724853
Share on other sites

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.