找回密码
 立即注册

只需一扫,快速开始

QQ登录

只需一步,快速开始

搜索
查看: 30335|回复: 0

[技术经验] 修复方案Discuz! Database Error(1062) Duplicate entry '369' for key 2 INSERT I...

[复制链接]

8万

主题

431

回帖

9万

积分

管理员

积分
94390
QQ
发表于 2016-3-27 11:34:06 | 显示全部楼层 |阅读模式
Discuz! Database Error(1062) Duplicate entry '369' for key 2 INSERT INTO forum_post SET `fid`='5' , `tid`='3749' , `first`='1' , `author`='王者之风' , `authorid`='191' , `subject`='发帖错误测试' , `dateline`='1337835686' , `message`='发帖错误测试' , `useip`='183.15.58.205' , `invisible`='0' , `anonymous`='0' , `usesig`='1' , `htmlon`='0' , `bbcodeoff`='-1' , `smileyoff`='-1' , `parseurloff`=0 , `attachment`='0' , `tags`='1,测试 ' , `replycredit`='0' , `status`='0' , `pid`='369'

123.jpg


找了半天,发现是数据库中数据不匹配造成的。
pre_forum_post_tableid 和 pre_forum_post表都存在一个字段,pid字段。但是dz的机制并非是直接从pre_forum_post获取最新帖子的pid,而是用pre_forum_post_tableid中的pid来做处理。如果pre_forum_post_tableid表中pid最大字段值小于pre_forum_post他的pid值,发帖就会报错。


排序一下,把他们最大的那个pid值设置为较大的一个。即可。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册   

本版积分规则

QQ|Archiver|手机版|小黑屋|站秘书 ( 蜀ICP备15034504号-3 )

GMT+8, 2024-5-6 12:55 , Processed in 0.094629 second(s), 43 queries .

Powered by Discuz! X3.5

Copyright © 2001-2024 Tencent Cloud.

快速回复 返回顶部 返回列表