discuz中這樣的sql如何寫

來源:互聯網
上載者:User
條件是: 某版塊的某分類資訊的資料


回複討論(解決方案)

某個板塊下的可以顯示的分類資訊(可用)

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('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

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.