order('`order` desc,`id` desc')->limit(0,10)->select(); foreach($left_typ">
时间:2021-07-01 10:21:17 帮助过:27人阅读
$left_type = M('type')->where("`pid`='2'")->order('`order` desc,`id` desc')->limit(0,10)->select();
foreach($left_type as $v){ $left_goods = M('goods')->where("`pid`='$v[id]'")->order('`order` desc,`id` desc')->limit(0,10)->select();}
$result=M('goods')->join('RIGHT JOIN goods ON goods.pid = type.id')->select();
foreach($result as $key=>$v){
$value[$v['pid']][$key]['goodsname']=$v['goodsname'];
//...goods要取的内容
}
页面显示的话用两个volist循环可以搞定
$type_list = M("Type")->where()->order()->limit()->select();foreach($type_list as $key=>$val){ $type_list['items'] = M("Goods")->where("pid={$val['id']}")->select();}