This question already has answers here:
When to use single quotes, double quotes, and backticks in MySQL
(12个答案)
2年前关闭。
尝试运行INSERT语句时出现以下错误:
错误:插入公司(
province1,w9w9w9,加拿大)您的SQL语法有误;校验
与您的MariaDB服务器版本相对应的手册
在'46 street sw,city1,province1,w9w9w9,附近使用正确的语法,
国家/地区)”在第1行
这是礼物:
array(7){[“” company“] =>字符串(8)” company1“ [” adr_street“] =>
字符串(15)“ 67 46 street sw” [“ city”] =>字符串(5)“ city1” [“ prov”] =>
字符串(9)“ province1” [“邮政”] =>字符串(6)“ w9w9w9” [“国家”] =>
string(6)“ Canada” [“ Submit”] => string(6)“ submit”}
这是查询:
任何见识将不胜感激。
谢谢!
(12个答案)
2年前关闭。
尝试运行INSERT语句时出现以下错误:
错误:插入公司(
company
,adr_street
,city
,Prov
,postal
,country
)值(company1、67 46 street sw,city1,province1,w9w9w9,加拿大)您的SQL语法有误;校验
与您的MariaDB服务器版本相对应的手册
在'46 street sw,city1,province1,w9w9w9,附近使用正确的语法,
国家/地区)”在第1行
这是礼物:
array(7){[“” company“] =>字符串(8)” company1“ [” adr_street“] =>
字符串(15)“ 67 46 street sw” [“ city”] =>字符串(5)“ city1” [“ prov”] =>
字符串(9)“ province1” [“邮政”] =>字符串(6)“ w9w9w9” [“国家”] =>
string(6)“ Canada” [“ Submit”] => string(6)“ submit”}
这是查询:
$sql="INSERT INTO company (`company`, `adr_street`, `city`, `Prov`, `postal`, `country`) VALUES ($company, $adr_street, $city, $prov, $postal, $country)";
任何见识将不胜感激。
谢谢!
最佳答案
将您的文本/字符串值用单引号引起来,如下所示。
INSERT INTO company (company, adr_street, city, Prov, postal, country)
VALUES ('company1', '67 46 street sw', 'city1', 'province1', 'w9w9w9', 'Canada');
关于php - mysql INSERT INTO语法错误-Newish User :) ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/46225073/
10-11 10:36