如何在laravel中获得mysql\u结果

ldioqlga  于 2021-06-21  发布在  Mysql
关注(0)|答案(0)|浏览(191)

我怎样才能在拉威尔得到你的结果

public function getList($queryParams = [])
    {
        $result = new \App\BaseModel();
        $modelClass = $this->modelClass;
        $query = $this->getQuery($queryParams);
        $sqlResult = $this->query();
        dump($query);
        $sqlResult =DB::select($query); //here I receive an array But I need to receive mysql_result

        if($sqlResult) {
            while($row = mysqli_fetch_assoc($sqlResult)) {
                $result[$row[$this->listKey]] = new $modelClass($row);
            }
        }

        if($this->calcFoundRows) {
            $this->foundRows = (int) array_shift(mysql_fetch_row($this->query('SELECT FOUND_ROWS()')));
        }
        dd($result);
        return $result;
    }

我有一个异常mysqli\u fetch\u assoc()期望参数1是mysqli\u result,给定的对象

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题