1390使用Laravel 5.6错误,Prepared语句包含太多占位符

时间:2019-03-24 17:48:20

标签: php mysql laravel laravel-5 where-in

我收到订单清单时遇到问题。这不在Laravel中的WHERE IN子句中。我该如何解决这个问题?

我使用array_chank拆分某些部分的数组,并将每个部分与不同的WHERE IN一起使用。

这是我的代码:

 $data = [];
        $total_price_orders = 0;
        $prod_controller = new ProductController();
        $promocode_controller = new CouponController();
        $orderQuery = Order::query();
        $products = new OrderProductController();

if ($request->has('vydavnytstvo')) {
            $publishHousesVal = $request['vydavnytstvo'];
            $publishHousesName = [];
            foreach ($publishHousesVal as $item){
                $house = DB::table('properties')->where('id', $item)->pluck('value')->toArray();
                $publishHousesName[] = $house;
            }

            $productsArray = DB::table('products')->whereIn('publishing_house', $publishHousesName)->pluck('id')->toArray();
            $orders = DB::table('order_product')->whereIn('product_id', $productsArray)->pluck('order_id')->toArray();

           // $orderQuery->whereIn('id', $orders);

            foreach (array_chunk($orders, 1000) as $array){
                $orderQuery->whereIn('id', $array);
            }

0 个答案:

没有答案