帝国cms常用的SQL语句
1.复制tags字段内容到keyboard,当keyboard为空的时候:update [!db.pre!]ecms_news_data_1 a, [!db.pre!]ecms_news b set b.keyboard=a.infotags where a.id=b.id and&#1……
1.复制tags字段内容到keyboard,当keyboard为空的时候:
update [!db.pre!]ecms_news_data_1 a, [!db.pre!]ecms_news b set b.keyboard=a.infotags where a.id=b.id and b.keyboard='';
2.添加tags字段内容到keyboard:
update [!db.pre!]ecms_news_data_1 a, [!db.pre!]ecms_news b set b.keyboard=concat(b.keyboard,',',a.infotags) where a.id=b.id and b.keyboard<>'' and a.infotags<>'';
3.如果副表中keyid(相关链接)字段为空,说明keyboard设置不合理,干脆清空,为自动分词扫清障碍
update [!db.pre!]ecms_news_data_1 a, [!db.pre!]ecms_news b set b.keyboard='' where a.id=b.id and a.keyid=''
4.newstext在副表,提取第一张图片为标题图片。当标题图片为空的时候。
update [!db.pre!]ecms_news_data_1 a, [!db.pre!]ecms_news b set b.titlepic=concat(replace(SUBSTRING_INDEX(SUBSTRING_INDEX(a.newstext, '.jpg', 1),'src=',-1),'"',''),'.jpg') where a.newstext like '%.jpg%' and b.titlepic='' and a.id=b.id;update [!db.pre!]ecms_news_data_1 a, [!db.pre!]ecms_news b set b.titlepic=concat(replace(SUBSTRING_INDEX(SUBSTRING_INDEX(a.newstext, '.gif', 1),'src=',-1),'"',''),'.gif') where a.newstext like '%.gif%' and b.titlepic='' and a.id=b.id;
- 上一篇
帝国CMS模板调用标签:只调用当天发布的信息
帝国cms模板调用小技巧:只调用当天发布的信息应该怎么写标签呢?<?php$timedays=strtotime(date("Y-m-d",time()));//今天0点的时间点$timedaye=$timedays+3600*24;//今天24点的时间点,两个值之间即为今天一天内的数据$xi
- 下一篇
帝国CMS调用今日下载本月下载本周下载排行方法
实现方法第一步在数据表里添加三个字段:DayHits WeekHits MonthHits 分别设为字段类型为INT第二步打开文件:/e/public/ViewClick/index.php(//digg踩数后面添加如下代码)//日下载数elseif($down==7){$r=$empire->fetch1("