This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-16. For the latest, interactive version please visit https://mariadb.com/kb/.

Getting syntax error while inserting data

NSERT INTO details ('Reference ID','Type of Request','User Start/Term/Change Date','User Full Name','Manager/Supervisor Name','Department U.S','Department International','User Temp/Contractor','Last date for Temp/Contractor','Computer Model','Other Equipment Instructions','Create Email Account','Other Email Instructions','Location for adding to DL','Distribution Lists','Remove from DL','Department Share Access','Other Share/s Access','Remove from department share/s','Personal Software-Vector NTI Standalone','Personal Software-Resharper','Personal Software-Matlab Standalone','Personal Software-Matlab Concurrent','Personal Software-Project Pro','Personal Software-Visio Std','Personal Software-Visual Studio','Personal Software-Perforce','Personal Software-JMP Annual','Personal Software-Solidworks Pro','Personal Software-Solidworks Premium','Personal Software-Kaleidagraph','Personal Software-SnagIt','Personal Software-Zemax','Additional Software','IT Ent App-SAP','IT Ent App-Agile','IT Ent App-Camstar','IT Ent App-QlikView','IT Ent App-HPQC','IT Ent App-Terminal Server Access','IT Ent App-Sharepoint','IT Ent App-CommVault','IT Ent App-SalesForce','IT Ent App-Amazon_S3','IT Ent App-RemedyForce','IT Ent App-Bugzilla','Other Needs') VALUES ('0','Request a new application or service','2020-10-30','test test','test test test','Select an item','405SGP - Service Singapore','on','2020-10-21','Macintosh MacBook Pro 13"-Standard issue small form factor Mac.(Smallest & lightest Mac form factor)','test test test test test test test test test test test','on','','on','on','on','DL-Test','DL- Test Test','
Test','
pbi','
fs\users','on','on','on','on','on','on','on','on','on','on','on','on','test test test','Remove','Add','Add','Add','Remove','Remove','Add','Add','Add','Add','Remove','Remove','test test') You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''Reference ID','Type of Request','User Start/Term/Change Date','User Full Nam...' at line 1

My code $sql = "INSERT INTO details('Reference ID','Type of Request','User Start/Term/Change Date','User Full Name','Manager/Supervisor Name','Department U.S','Department International','User Temp/Contractor','Last date for Temp/Contractor','Computer Model','Other Equipment Instructions','Create Email Account','Other Email Instructions','Location for adding to DL','Distribution Lists','Remove from DL','Department Share Access','Other Share/s Access','Remove from department share/s','Personal Software-Vector NTI Standalone','Personal Software-Resharper','Personal Software-Matlab Standalone','Personal Software-Matlab Concurrent','Personal Software-Project Pro','Personal Software-Visio Std','Personal Software-Visual Studio','Personal Software-Perforce','Personal Software-JMP Annual','Personal Software-Solidworks Pro','Personal Software-Solidworks Premium','Personal Software-Kaleidagraph','Personal Software-SnagIt','Personal Software-Zemax','Additional Software','IT Ent App-SAP','IT Ent App-Agile','IT Ent App-Camstar','IT Ent App-QlikView','IT Ent App-HPQC','IT Ent App-Terminal Server Access','IT Ent App-Sharepoint','IT Ent App-CommVault','IT Ent App-SalesForce','IT Ent App-Amazon_S3','IT Ent App-RemedyForce','IT Ent App-Bugzilla','Other Needs') VALUES ('0','$Type_of_Request','$Date','$Users_Full_Name','$Manager_Name','$Dept_USA','$Dept_International','$Temp_Contractor','$Last_expected_date','$Computer','$Other_Equipment','$Create_Email','$Email_instructions','$Menlo_campus','$Singapore_Campus','$Field_Campus','$DL','$Remove_from_DL','$Dept_share_access','$Other_share_access','$Remove_from_dept_share','$Vector_NTI_Standalone','$Resharper','$Matlab_Standalone','$Project_Pro','$Visio_Std','$Perforce','$JMP_Annual','$Solidworks_Pro','$Solidwork_Premium','$Kaleidagraph','$SnagIt','$Zemax','$Additional_Software','$SAP','$Agile','$Camstar','$QlikView','$HPQC','$Terminal_Server_Access','$Sharepoint','$CommVault','$SalesForce','$Amazon_S3','$RemedyForce','$Bugzilla','$Other_Needs')";

I am v new to MariaDB/SQL

Answer Answered by Ian Gilfillan in this comment.

See Identifier Names. You need to use the backtick (`) character to quote identifiers, not a single-quote (').

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.