• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

discuz中这样的sql如何写

php 搞代码 4年前 (2022-01-23) 8次浏览 已收录 0个评论
文章目录[隐藏]

条件是: 某版块的某分类信息的数据

回复讨论(解决方案)

某个板块下的可以显示的分类信息(可用)

function get_threadclass($fid){		$threadtypes = C::t('forum_forumfield')->fetch($fid);		$threadtypes = dunserialize($threadtypes['threadtypes']);		foreach(C::t('forum_threadclass')->fetch_all_by_fid($fid) as $type) {			if(isset($threadtypes['types'][$type['typeid']])) {				$return[]=$type;			}		}		return $return;	}

某个板块下的可以显示的分类信息(可用)

function get_threadclass($fid){		$threadtypes = C::t('forum_forumfield')->fetch($fid);		$threadtypes = dunserialize($threadtypes['threadtypes']);		foreach(C::t('forum_threadclass')->fetch_all_by_fid($fid) as $type) {			if(isset($threadtypes['types'][$type['typeid']])) {				$return[]=$type;			}		}		return $return;	}

好象我的表述有点问题: 是这样
我主要是想要帖子中的message字段里的信息,条件是 该版块下的 A子版块中的 D主题分类的所有帖子中的 message的内容
我想了一下,好象是要用到 pro_forum_post这个表及主题分类表 pre_forum_threadclass

因为 pro_forum_post里面有message帖子内容信息的字段,而 pre_forum_threadclass里面是主题分类的表,但是这两个表如何关联呢?

我写了一个句子,查不出来,不知哪里错了。
我是这样写的:SELECT sh_forum_post.message, sh_forum_post.fid FROM sh_forum_post, sh_forum_threadclass WHERE sh_forum_post.fid = 128 AND sh_forum_threadclass.`name` = ‘美丽图片’

discuz中的表有一点很让人闹心,那就是很多表中的字段没有关联性,都是独立的,所以无法做出关系条件来

某个板块下的可以显示的分类信息(可用)

function get_threadclass($fid){		$threadtypes = C::t('forum_forumfield')->fetch($fid);		$threadtypes = dunserialize($threadtypes['threadtypes']);		foreach(C::t<a>@本文9来源gao($daima.com搞@代@#码8网^</a><strong>搞代gaodaima码</strong>('forum_threadclass')->fetch_all_by_fid($fid) as $type) {			if(isset($threadtypes['types'][$type['typeid']])) {				$return[]=$type;			}		}		return $return;	}

好象有点门,我是这样想的,论坛里默认的源码中,点那些主题分类就可以出现我要的效果,看来源码中就有这句sql
那,他是怎么写的呢,它的地址是这样,帮我分析一下,谢谢你 jam00,
http://127.0.0.1/forum.php?mod=forumdisplay&fid=129&filter=typeid&typeid=26

pre_forum_thread里的字段typeid就是分类信息的id


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:discuz中这样的sql如何写
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址