·设为首页收藏本站📧邮箱修改🎁免费下载专区💎积分✅卡密📒收藏夹👽聊天室
返回列表 发布新帖

Discuz! X 数据查询表 - 常用查询

408 0
发表于 2020-7-7 09:09:28 | 查看全部 阅读模式

马上注册,免费下载更多dz插件网资源。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
调用最新主题
  1. $new=DB::fetch_all("SELECT tid,subject FROM ".DB::table('forum_thread')." ORDER BY `dateline` desc LIMIT 0,1;");
复制代码

调用最新主题封面图
  1. $img=DB::fetch_all("SELECT a.subject,a.tid,b.attachment FROM ".DB::table("forum_thread")." a LEFT JOIN ".DB::table("forum_threadimage")." b on b.tid=a.tid WHERE a.`attachment`=2 ORDER BY a.`dateline` DESC LIMIT 0,5");
复制代码

调用当前登录用户阅读权限
  1. $read=DB::result(DB::query("SELECT b.readaccess FROM ".DB::table('common_member')." a left join ".DB::table('common_usergroup_field')." b on b.groupid=a.groupid WHERE a.`uid`= '$_G[uid]'"));
复制代码

调用常用统计数据
  1. //获取VERSION、RELEASE$version = unserialize($_G['setting']['cloudaddons_newversion']);//获取站长用户名$name = DB::result_first("select username from ".DB::table("common_member")." where uid = 1");//获取建站时间$time = DB::result_first("select regdate from ".DB::table("common_member")." where uid = 1");//获取模板个数$templates = DB::result_first("select count(styleid) from ".DB::table("common_style")."");//获取插件个数$plugins = DB::result_first("select count(pluginid) from ".DB::table("common_plugin")."");//获取会员人数$users = DB::result_first("select count(uid) from ".DB::table("common_member")."");//获取临时会员人数$guests = DB::result_first("select count(conopenid) from ".DB::table("common_connect_guest")."");//获取会员总人数$all_users = $users + $guests;//获取管理团队人数$admins = DB::result_first("select count(uid) from ".DB::table("common_member")." where groupid in (1,2)");//获取最新注册会员$newuser = DB::result_first("select username from ".DB::table("common_member")." order BY regdate desc");//获取发帖会员人数$post_posts = DB::result_first("select count(uid) from ".DB::table("common_member_count")." where posts > 0 ");//获取发表主题会员人数$post_threads = DB::result_first("select count(uid) from ".DB::table("common_member_count")." where threads > 0 ");//获取版块数$forums = DB::result_first("select count(fid) from ".DB::table("forum_forum")." where type = 'forum' and status in (0,1)");//获取总帖数$posts = DB::result_first("select count(pid) from ".DB::table("forum_post")."");//获取主题数$threads = DB::result_first("select count(tid) from ".DB::table("forum_thread")."");//获取精华主题数$digest = DB::result_first("select count(digest) from ".DB::table("forum_thread")." where digest > 0");//获取高亮主题数$highlight = DB::result_first("select count(highlight) from ".DB::table("forum_thread")." where highlight > 0");//获取置顶主题数$displayorder = DB::result_first("select count(displayorder) from ".DB::table("forum_thread")." where displayorder > 0");//获取附件主题数$attachment = DB::result_first("select count(tid) from ".DB::table("forum_thread")." where attachment > 0");//获取待审核主题数$moderate_threads = DB::result_first("select count(id) from ".DB::table("forum_thread_moderate")." where status = 0");//获取已忽略主题数$moderate_ignore_threads = DB::result_first("select count(id) from ".DB::table("forum_thread_moderate")." where status = 1");//获取待审核回复数$moderate_posts = DB::result_first("select count(id) from ".DB::table("forum_post_moderate")." where status = 0");//获取已忽略回复数$moderate_ignore_posts = DB::result_first("select count(id) from ".DB::table("forum_post_moderate")." where status = 1");//获取主题回收站数$recyclebin_threads = DB::result_first("select count(tid) from ".DB::table("forum_thread")." where displayorder = -1");//获取回复回收站数$recyclebin_posts = DB::result_first("select count(tid) from ".DB::table("forum_post")." where invisible = -5");//获取访问总数$views = DB::result_first("select sum(views) from ".DB::table("forum_thread")."");//获取回复总数$replies = DB::result_first("select sum(replies) from ".DB::table("forum_thread")."");//获取支持总数$recommend_add = DB::result_first("select sum(recommend_add) from ".DB::table("forum_thread")."");//获取反对总数$recommend_sub = DB::result_first("select sum(recommend_sub) from ".DB::table("forum_thread")."");//获取收藏总数$favtimes = DB::result_first("select sum(favtimes) from ".DB::table("forum_thread")."");//获取分享总数$sharetimes = DB::result_first("select sum(sharetimes) from ".DB::table("forum_thread")."");//获取会员:男性$users_man = DB::result_first("select count(uid) from ".DB::table("common_member_profile")." where gender = 1 ");//获取会员:女性$users_woman = DB::result_first("select count(uid) from ".DB::table("common_member_profile")." where gender = 2 ");//获取会员:80后$users_80 = DB::result_first("select count(uid) from ".DB::table("common_member_profile")." where birthyear > 1980 and birthyear < 1989 ");
复制代码
我要说一句 收起回复
一花一世界,一叶一追寻。一曲一场叹,一生为一人。

回复

 懒得打字嘛,点击右侧快捷回复【查看最新发布】   【应用商城享更多资源】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

创宇盾启航版免费网站防御网站加速服务
投诉/建议联系

discuzaddons@vip.qq.com

未经授权禁止转载,复制和建立镜像,
如有违反,按照公告处理!!!
  • 联系QQ客服
  • 添加微信客服

联系DZ插件网微信客服|最近更新|Archiver|手机版|小黑屋|DZ插件网! ( 鄂ICP备20010621号-1 )|网站地图 知道创宇云防御

您的IP:13.59.95.99,GMT+8, 2024-12-19 06:19 , Processed in 0.171966 second(s), 76 queries , Gzip On, Redis On.

Powered by Discuz! X5.0 Licensed

© 2001-2024 Discuz! Team.

关灯 在本版发帖
扫一扫添加微信客服
QQ客服返回顶部
快速回复 返回顶部 返回列表