gpt4 book ai didi

php - #1062 - key '31' 的重复条目 'PRIMARY'

转载 作者:太空宇宙 更新时间:2023-11-03 12:27:30 25 4
gpt4 key购买 nike

php 错误:

#1062 - Duplicate entry '31' for key 'PRIMARY'

查询:

INSERT INTO `calls`(
`id`, `number`, `type`, `charges`, `duration`, `date`, `c_number`
)
VALUES (31,'03227453033','onnet',2,1,'2012-12-06','03216196069')

id 是我的主键,它会自动递增。目前我的数据库中有 30 行表。

最佳答案

对于自动递增字段,您可以将其排除在 SQL 插入查询之外,因为 mysql 会自动填充它。只有定义为自增字段时才这样做。

INSERT INTO `calls`(`number`, `type`, `charges`, `duration`, `date`, `c_number`)
VALUES ('03227453033' ,'onnet', 2, 1, '2012-12-06', '03216196069')

关于php - #1062 - key '31' 的重复条目 'PRIMARY',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16949994/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com