2017-09-14 3 views
0

ich folgende Fehlermeldung erhalten, wenn sie versuchen, die eine INSERT-Anweisung auszuführen:mysql INSERT INTO Syntaxfehler - Newish Benutzer :)

ERROR: INSERT INTO company (company , adr_street , city , Prov , postal , country) VALUES (company1, 67 46 street sw, city1, province1, w9w9w9, Canada) 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 '46 street sw, city1, province1, w9w9w9, Country)' at line 1

Dies ist vardump:

array(7) { ["company"]=> string(8) "company1" ["adr_street"]=> string(15) "67 46 street sw" ["city"]=> string(5) "city1" ["prov"]=> string(9) "province1" ["postal"]=> string(6) "w9w9w9" ["country"]=> string(6) "Canada" ["Submit"]=> string(6) "submit" }

Dies ist die Abfrage :

$sql="INSERT INTO company (`company`, `adr_street`, `city`, `Prov`, `postal`, `country`) VALUES ($company, $adr_street, $city, $prov, $postal, $country)"; 

Jeder Einblick würde geschätzt werden.

Danke!

Antwort

0

Wickeln Sie Ihre Text/String-Werte mit einem Anführungszeichen wie unten.

INSERT INTO company (company, adr_street, city, Prov, postal, country) 
VALUES ('company1', '67 46 street sw', 'city1', 'province1', 'w9w9w9', 'Canada');