Home > Database > Mysql Tutorial > body text

insert-mysql数据插入,计数时出现重复,序号不对

WBOY
Release: 2016-06-06 09:44:19
Original
1211 people have browsed it

insertmysql

有一个问题想请教各位大大,关于使用php向mysql插入数据,
表中主要有三个字段:自增的id,活动名,活动参与序号,其他可忽略
主键id自增用来记录数据,
活动字段记录活动名,
活动参与序号根据mysql查询对应活动,新插入时加一,比如
id huodong hid
1 aaa 1
2 aaa 2
3 aaa 3
4 bbb 1
5 bbb 2
6 ccc 1
即每次活动hid从一开始累加
现在出现的问题是,不知道是不是服务器原因,hid计数不正确,会重复,比如这样
id huodong hid
1 aaa 1
2 aaa 2
3 aaa 2
4 aaa 4
5 aaa 4
6 aaa 6

总数不错,但序号不正确,

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!