帝国CMS教程使用技巧自定义列表标签SQL数据调用实例

来源:互联网 发布:交通cad软件 编辑:程序博客网 时间:2024/04/29 22:44

所有字段:select count(*) as total from phome_ecms_news where classid=1 and checked=1

说明:关键词(keyboard)北京的信息调用出来

统计总共有多少条信息:select count(*) as total from [!db.pre!]ecms_news where checked=1 and 
keyboard like '%北京%'

查询总共有多少条记录:select * from [!db.pre!]ecms_news where checked=1 and keyboard like '%北
京%' order by newstime desc

显示结果举例:

http://www.imtoday.cn/news/hubei/
http://www.imtoday.cn/news/sichuan/
http://www.imtoday.cn/news/hunan/
http://www.imtoday.cn/news/fujian/
------------------------------------------------------------------------------------------

扩展查询:

统计总共有多少条信息:select count(*) as total from [!db.pre!]ecms_news where checked=1 and 
keyboard like '%北京%' and isgood=1

查询总共有多少条记录:select * from [!db.pre!]ecms_news where checked=1 and keyboard like '%北
京%' and isgood=1 order by newstime desc (排序可以修改)

------------------------------------------------------------------------------------------
isgood=0 普通信息、isgood=1 一级推荐