tp框架大神来看看

WBOY
發布: 2016-07-06 13:54:13
原創
2161 人瀏覽過

<code> $list=$Model->query("select * from activity,apply where apply.ac_id=activity.ac_id and apply.unionid='{$unionid}' order by ap_id desc");</code>
登入後複製
登入後複製

这段sql语句如何用tp中的提供的 $User->where('status=1')->order('create_time')->limit($Page->firstRow.','.$Page->listRows)->select();

类似这种的写法 我的应该怎么写 谢谢大神

回复内容:

<code> $list=$Model->query("select * from activity,apply where apply.ac_id=activity.ac_id and apply.unionid='{$unionid}' order by ap_id desc");</code>
登入後複製
登入後複製

这段sql语句如何用tp中的提供的 $User->where('status=1')->order('create_time')->limit($Page->firstRow.','.$Page->listRows)->select();

类似这种的写法 我的应该怎么写 谢谢大神

一楼兄弟回答的就可以貌似把分页给漏了,你自己在一楼兄弟回答的基础上加上limit($Page->firstRow, $Page->listRows)就可以了。试试吧!希望对你有帮助

<code>$list=M("activity ac")->join("left join apply ap on ac.ac_id=ap.ac_id")->where("apply.unionid=".$unionid)->order("ap_id desc")->select();</code>
登入後複製
相關標籤:
php
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!