- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
尝试运行 INSERT 语句时出现以下错误:
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
这是 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" }
这是查询:
$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 语法错误 - 新用户 :),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46225073/
我是一名优秀的程序员,十分优秀!