Version: 2.15Updated: 07.12.2023ModificationsVisitors: 958132ImprintFeedbackLiabilityDonation (CHF 10)Created by PFS
Tipps und Tricks rund um den Computertipps_und_tricks_computer
Tips and tricks for your computer
Translate with Google
2017-07-16  PHP MySQL Spaltenname: from, group, order, to - Fehlermeldung 
Problem:
Bei folgendem INSERT-Befehl:

INSERT INTO consumables (Product,Purity,Mark,Quantity,NbArticle,Furnisher,PriceCHF,Local,Box,Temperature,Remark,DateOrder,Initials,InfoCorrected,ProductClass,OrderedBy,Group,Order,Phone,Fax,From,To_,Type_,CountITEMS,TotalRecordsCount,SumCHF,PriceTOTCHF,Unit,DateID,YearID,CompanyID,ClientID,File,Reserve1,Reserve2) VALUES ("acid green 27","","Aldrich",1,"2133-1","Sigma-Aldrich","0","chemicals cupboard","","Ambiante","En stock 12.02.2016","2000-01-02","","","","Peter Parker","","","0800 8000 80","","","","Produit chimique",0,0,"","0","25 g","",0,0,"","","","");

erhält man folgende Fehlermeldung:

Fehler mit SQL-Befehl Das Problem wird dem Webmaster gemeldet!
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 'Group,Order,Phone,Fax,From,To_,Type_,CountITEMS,TotalRecordsCount,SumCHF,PriceTO' at line 1
INSERT INTO consumables (Product,Purity,Mark,Quantity,NbArticle,Furnisher,PriceCHF,Local,Box,Temperature,Remark,DateOrder,Initials,InfoCorrected,ProductClass,OrderedBy,Group,Order,Phone,Fax,From,To,Type_,CountITEMS,TotalRecordsCount,SumCHF,PriceTOTCHF,Unit,DateID,YearID,CompanyID,ClientID,File,Reserve1,Reserve2) VALUES ("acid green 27","","Aldrich",1,"2133-1","Sigma-Aldrich","0","chemicals cupboard","","Ambiante","En stock 12.02.2016","2000-01-02","","","","Peter Parker","","","0800 8000 80","","","","Produit chimique",0,0,"","0","25 g","",0,0,"","","","");
Lösung:
Das Problem sind reservierte Wörter in MySQL für Spaltennamen. Zum Beispiel from, group, order, to. Man kann diese reservierten Namen trotzdem benutzen, wenn man statt "group" einfach `group` verwendet. Das muss man bei allen MySQL-Befehlen konsequent umsetzen. Ansonsten könnte man nicht reservierte Namen einsetzen: from_, group_, order_, to_.

Keywords und reservierte Wörter:

Keywords and Reserved Words
Translate with Google
Link to this page


Advertisement:
O&O Software -
 
Advertisement:
Giveaway of the Day