thinkphp問答系統後台老闆的列表展示

來源:互聯網
上載者:User
thinkphp問答系統背景列表展示
要求如下:
管理中心
15) 管理員才可進入
16) 可禁止使用者發言
17) 對問題/回答進行刪除

目前代碼如下:
 function index(){
$goods= D('question');
$count = $goods->count();
$Page = new \Think\Page($count,6);

$list = $goods->table('ask.question question, ask.answer answer,ask.user user')->where('question.id = answer.tqu and question.userid= user.id')->field('question.id as quid,question.text as qutext,question.addtext as quadd, question.userid as quuserid,answer.text as antext,answer.addtext as answeradd, answer.userid as anuserid,answer.up,answer.down,user.name')->order(' question.id asc' )->limit($Page->firstRow.','.$Page->listRows)->select();


$show = $Page->show();

$this->assign('list',$list);
var_dump($list);
$this->assign('page',$show);
$this->display();


1.因為 question 和 answer 兩個表都有對應的 userid.我想要一個問題下 然後下面對應相應的答案.下個問題,對應相應的答案.這個查詢語句應該如何寫.

2.或者應該如何展示效果更好.
------解決思路----------------------
15) 管理員才可進入
使用者表對應一個許可權欄位,登入時判斷,為1即管理員。
16) 可禁止使用者發言
使用者表對應一個使用者狀態欄位,屬性為0時發帖提示許可權不足
17) 對問題/回答進行刪除
delete對應id

1.因為 question 和 answer 兩個表都有對應的 userid.我想要一個問題下 然後下面對應相應的答案.下個問題,對應相應的答案.這個查詢語句應該如何寫.
迴圈巢狀查詢

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.