thinkphp中联表查询(多表)

thinkphp中联表查询(多表)

ps:本人亲测,阿里云2核4G5M的服务器性价比很高,新用户一块多一天,老用户三块多一天,最高可以买三年,感兴趣的可以戳一下:阿里云折扣服务器

//编辑订单
    public function order_edit(){
        $obj=M('car_order');
        $obj1=M('car_project');
        if(!empty($_REQUEST['id'])){
            $id = I('get.id');
            $res = $obj->alias('a')->join('join cms_car_brand as b on a.order_brand=b.id join cms_car_style as c on a.order_style=c.id join cms_car_output as d on a.order_output=d.id join cms_car_year as e on a.order_year=e.id')->where("a.id=$id")->field('a.id as aid,a.order_user_name as ausername,a.order_ment as ament,a.order_weixiu_content as aweixiu,a.order_car_num as anum,a.order_price as aprice,a.order_status as astatus,a.order_type as atype,a.order_licheng as alicheng,b.brand_name as bname,c.style_name as cname,d.output_name as dname,e.year_name as ename,a.order_project as aproject')->find();
            $arr=explode('-',$res['aproject']);
            foreach($arr as $a){
                $pro_id['id']=$a;
                $b=$obj1->where($pro_id)->find();
                $res1[]=$b['project_name'];
            }
            $this->assign('res1', $res1);
            $this->assign('res', $res);
        }
        $this->display();
    }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值