手记

foreach 遍历要点 foreach遍历查询 将两个表里面的每一天记录都出来了

$list = $money_num -> where($name)->limit($Page->firstRow.','.$Page->listRows)->select();

        foreach($list as $k => $name){
            $zz_id = $name['zhuanzhang_id'];
            $name_p = $tr -> where('userid='.$zz_id) -> getField('username');
            $list[$k]['zz_name']=$name_p;
        }

例子二:
public function index(){
$type = I('shop_type');
$msg = M('product');
$msg_shop = M('shopkucun');
$where['s_id']=6;
$arr = $msg_shop-> where($where)-> order("p_id") -> select();
foreach($arr as $v){
$where['p_id']=$v['p_id'];
$msg_detail[] = $msg -> where($where) -> find();
}

    $this-> assign('msg_detail',$msg_detail);
    $this->display('service');
}
0人推荐
随时随地看视频
慕课网APP