语法错误或访问冲突:1064您在Lumen 5.6中的SQL语法中有错误

时间:2018-07-12 06:58:56

标签: mysql mongodb lumen

在我的lumen 5.6中,我将mysql作为我的默认数据库连接和mongodb。一切都很好,直到我尝试在一个查询中执行2个DB。

在我的控制器上

public function try(){        

    $userinfo = DB::connection('mongodb')->table('userinformations')
                    ->get();
    print_r($userinfo);
    $user = DB::table('users')
            ->join($userinfo, 'users.iduser', '=', 'userinformations.iduser')
            ->select('users.iduser','users.nickname')
            ->get();

    return response()->json($user);
}
QueryCallback日志上的

users内部联接'[{{__id“:{” $ oid“:” 5b46df3ee781b6ff1b1e0096“}中'select iduserusersnicknameusers

但是当我print_r收集

Illuminate\Support\Collection Object

(     [item:protected] =>数组         (             [0] =>数组                 (                     [_id] => MongoDB \ BSON \ ObjectId对象                         (                             [oid] => 5b46df3ee781b6ff1b1e0096                         )

                [iduser] => 1
                [gender] => Male
                [profilephoto] => assets/profile/12.png
                [birth] => 2000-25-12
                [city] => Quezon City
                [mStatus] => Married
            )

预先感谢

0 个答案:

没有答案