tp6 leftJoin where条件报错

浏览:850 发布日期:2022/05/10
5.0.0 - 严重 - 未处理
$where = [];
        if(!empty($params['name'])) $where[] = ['h.name', 'like',"%{$params['name']}%"];
        if(!empty($params['url'])) $where[] = ['url', 'like',"%{$params['url']}%"];
        if(!empty($params['cate_name'])) $where[] = ['c.name', 'like',"%{$params['cate_name']}%"];
        $list = db::name('nhost')->alias('h')
            ->field('h.id, h.name host_name, h.url, h.create_time, c.name cate_name')
            ->leftJoin('ncate c', 'c.id=h.ncate_id')
            ->order('h.id desc')
            ->where($where)
            ->limit($limit_start, $params['pageSize'])
            ->select();
参数:pageNum=1&pageSize=10&name=baidu
报错:Column not found: 1054 Unknown column 'h.name' in 'where clause'
评论(
后面还有条评论,点击查看>>