1、查詢用戶列表,初始換關聯訂單表,但是用戶太多,導致mysql占位符過了,報mysql錯誤。
2、User::with('order')->get()
報錯:General error: 1390 Prepared statement contains too many placeholders
select * from order where user_id in (xxx,xxx , ......)因為后續需要循環處理訂單相關聯的數據。foreach ($user as $v) {
$order_list = $v->order;
$temp_test = [];
if (count($order_list) > 0) {
foreach ($order_list as $ov) {
$temp_test[] = $ov->order_id;
}
}
$data = [
'user_id' => $v->user_id,
'order_id' => implod(',', $temp_test)
];
echo $this->downExcel($data);
}
添加回答
舉報
0/150
提交
取消