php - 列数与第 1 行错误消息中的值计数不匹配,php / sql
问题描述
我必须使用 PHP 和 MySQL 工作台制作一个网页来收集表单数据,并且我不断收到此错误:
INSERT INTO tools ( id, tool1, tool2, tool3, tool4, tool5, tool6, tool7, tool8, tool9, tool10) VALUES ( '0','1', '2', '3', '4,' '5', '6', '7', '8', '9', '10')
INSERT failed: INSERT INTO tools ( id, tool1, tool2, tool3, tool4, tool5, tool6, tool7, tool8, tool9, tool10) VALUES ( '0','1', '2', '3', '4,' '5', '6', '7', '8', '9', '10')
Column count doesn't match value count at row 1
这就是我的代码的样子:
$query = "INSERT INTO tools ( id, tool1, tool2, tool3, tool4, tool5, tool6, tool7, tool8, tool9, tool10) VALUES ( '0','1', '2', '3', '4,' '5', '6', '7', '8', '9', '10')";
这就是它在工作台中的样子:
INSERT INTO tools (id, tool1, tool2, tool3, tool4, tool5, tool6, tool7, tool8, tool9, tool10) VALUES ( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
我已经尝试过没有 id 和 0 值,但都不起作用。有谁知道如何解决这一问题?
解决方案
你的代码
INSERT INTO tools ( id, tool1, tool2, tool3, tool4, tool5, tool6, tool7, tool8, tool9, tool10)
VALUES ( '0','1', '2', '3', '4,' '5', '6', '7', '8', '9', '10')
恰好在 4 到 5 之间有一个错误,撇号错开
它必须看起来像这样
INSERT INTO tools ( id, tool1, tool2, tool3, tool4, tool5, tool6, tool7, tool8, tool9, tool10)
VALUES ( '0','1', '2', '3', '4', '5', '6', '7', '8', '9', '10')
推荐阅读
- python - 重塑数据框并绘制堆积条形图
- amazon-web-services - 在 AWS CodeBuild 中将环境变量添加到 imagedefinitions.json 文件
- jenkins - 如何将构建日志文件附加到 Jenkins?
- python - 如果位置是偶数,如何从以前的列表中创建一个新列表,其中元素被添加到它们的位置?
- python - Lucid 能否可视化 MobileNet V3 Squeeze/Excite 块
- android -
不是每次都在安卓上播放 - php - 我想建立一个安全链接
- javascript - 更改滚动标题的位置
- opengl - 片段着色器忽略纹理坐标
- python-3.x - 如何使用for循环计算字典中的键数