Home >Backend Development >PHP Tutorial > 求教关于brophp框架中r_select()的用法解决思路

求教关于brophp框架中r_select()的用法解决思路

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:51:52989browse

求教关于brophp框架中r_select()的用法
  新人求教一个关于brophp框架r_select()的用法,今天在使用这个函数时候感到困惑,源代码如下:



            $order=D("user");


            $orderList=$order->field("uid")->where(array("uid"=>"8")->r_select(array('web_order','w_orderid,w_orderTime,w_workid,w_finishTime,state','uid'));


            p($orderList);


如上所示,我建有user和web_order两个表,uid为user表的主键,为web_order表的外键,对于user表可以用where()来限制,但如何对从表web_order的字段state进行限制呢,求教各位phper,无限感激。
想要得到 uid=‘8’&&state=“未维修”。


------解决方案--------------------
brophp 的 ORG 是很差的,在设计时并没有考虑你这样的需求
同时规则太多,参数形式也不统一

你可以给 where 方法的参数数组的关联键附加表名来解决
->where(array("uid"=>"8", 'web_order.state' => 'val'))
可通过 sql 方法看看 SQL 指令是否正确
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn