Blogger Information
Blog 4
fans 0
comment 0
visits 18825
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
mysql提示Column count doesn't match value count at row 1错误
张显森的博客
Original
16233 people have browsed it

mysql提示Column count doesn't match value count at row 1错误

这个问题就比较尴尬了,平时用框架用多了很少写添加的sql语句,从网上看了一下插入语句:

insert into table_name values (...);

因为想插入一些数据,自己当时给数据库表加个主键id,设置自增,本以为没影响,结果一下子报错了,搜了下明确了问题,把原来的id给去掉就可以了,因为数据略多就没在values前加上参数列表了,就只是把主键给删掉了,因为原来的数据里有唯一值就当主键使用了。

常规的正确的处理方式应该是:

insert into table_name (col1,col2,...) values (value1,value2,...);

LOG一下,这样可以时不时翻出来告诫自己不要太想当然,不能偷懒。

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!