帝国cms重建数据索引表解决Duplicate entry错误
提供Duplicate entry错误重建数据索引表的方法及sql语句用于恢复索引表到正常状态。
帝国cms在修改和添加任何内容的时候提示Duplicate entry错误,查看index数据表的记录值与其它的几个表的数量对应有一定的差别。
可以先偿试 在 系统 - 系统设置 -备份与恢复数据 中修复数据表,如果正常了以下就可以忽略。
查看字段除checked外都可以导出,哪么很可能是数据索引表坏掉了。需要重建一个数据表的索引,一个内容模型他是有8个表的,可以用以下语句依次恢复。
一次执行一个效率要高些,一个分号是一条语句下面的是新闻表的重建,其它的表对应修改。
CREATE TABLE [!db.pre!]ecms_newstemp AS(SELECT id,classid,newstime,truetime,lastdotime,havehtml FROM [!db.pre!]ecms_news); ALTER TABLE `[!db.pre!]ecms_newstemp` ADD COLUMN `checked` tinyint(1) not null DEFAULT 0 AFTER `classid`;
ALTER TABLE `[!db.pre!]ecms_newstemp` add primary key (id);
alter table [!db.pre!]ecms_news_index rename to [!db.pre!]ecms_news_indexbak;
alter table [!db.pre!]ecms_newstemp rename to [!db.pre!]ecms_news_index;
ALTER TABLE `[!db.pre!]ecms_news_index` CHANGE `id` `id` INT(10) NOT NULL AUTO_INCREMENT;
alter table [!db.pre!]ecms_news_index add index(classid);
alter table [!db.pre!]ecms_news_index add index(checked);
alter table [!db.pre!]ecms_news_index add index(newstime);
alter table [!db.pre!]ecms_news_index add index(truetime);
update [!db.pre!]ecms_news_index set checked=1;
帝国cms sql语句执行说明
执行的地方在:系统 - 系统设置 -备份与恢复数据 - 执行SQL语句 (在如上图的框里面执行)
相关推荐
-
帝国CMS多表调用最新信息的方法
这篇文章主要为大家介绍了帝国CMS多表调用最新信息的方法,主要通过灵动标签的sql语句调用结合union来实现,是非常实用的技巧,需要的朋友可以参考下
-
帝国CMS判断是否有内容分页的方法
帝国CMS判断是否有内容分页,有就显示,没有就不显示。以免没有的分页的时候占了一行位子,不是非常美观。
-
帝国CMS商城系统如何实现在线支付后发送订单邮件提醒功能
帝国CMS是个强大的内容管理系统,其商城的功能也很强大,当用户下单,支付后我们怎么知道有用户下单了呢?因为我们不能时时刻刻都在网站后台,不断的刷新页面去看有无订单,最常用的做法是用邮件提醒我们,有人下单了.
-
帝国CMS内容页附件中文显示或者显示代码名称下载
在帝国CMS模板制作中,比如内容页面显示该内容的附件地址,必须显示原始路径地址,或者说想要中文的路径地址。那么就要用以下方法来实现了:
-
帝国cms加载更多时调用对应文章的tags标签和链接
帝国cms如果使用点击加载更多的时候怎么样连gs标签和链接一起循环出来,如果是调用标题,简介,浏览,时间,这些单一的字都很简单