TP union 使用求助 万分感谢

浏览:2051 发布日期:2016/05/25 分类:求助交流 关键字: union
$Model = M();
$ProductView = $Model->field('productid')->table('mr_productspreadinfotj_20160522')->union('SELECT productid FROM mr_productspreadinfotj_20160523');
$count= $ProductView->count();// 查询满足要求的总记录数
$Page= new \Think\Page($count,C('DB_PAGENUM'));// 实例化分页类 传入总记录数和每页显示的记录数
$show= $Page->show();// 分页显示输出
$ProductView_list=$ProductView->limit($Page->firstRow.','.$Page->listRows)->select();
foreach($ProductView_list as $k => $v)
{
$pro=M('products')->where(array('p_id'=>$v['productid']))->find();
$ProductView_list[$k]['pd_productname'] = $pro['p_name'];
}
$this->assign('productdata_list',$ProductView_list);
$this->assign('page',$show);
}
$this->display();
最佳答案
评论( 相关
后面还有条评论,点击查看>>