Heim  >  Artikel  >  Backend-Entwicklung  >  tp框架大神来看看

tp框架大神来看看

WBOY
WBOYOriginal
2016-07-06 13:54:132159Durchsuche

<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>
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn