Laravel 5 如何使用;其中;及;“其中”;在同一个问题上
我希望这两个条件只检索匹配的数据,这意味着数据应该在这个范围内('date_applied',[$start_date,$end_date]),但它们也应该满足第二个条件Laravel 5 如何使用;其中;及;“其中”;在同一个问题上,laravel-5,Laravel 5,我希望这两个条件只检索匹配的数据,这意味着数据应该在这个范围内('date_applied',[$start_date,$end_date]),但它们也应该满足第二个条件->或者where('req_id',$req_id[$I])
->或者where('req_id',$req_id[$I])
$did = DB::table('ssrareqs')->select('particular_id', 'quantity_req', 'purpose', 'date_applied','date_approved', 'quantity_issued', 'remarks', 'status_issue', 'status_req') ->whereBetween('date_applied', [$start_date, $end_date]) ->orwhere('req_id', $req_id[$i]) ->get();
没有测试。希望它能起作用。只要提醒你必须使用使用
:
$did =DB::table('ssrareqs')->select('req_id','particular_id', 'quantity_req','purpose', 'date_applied','date_approved', 'quantity_issued', 'remarks', 'status_issue', 'status_req') ->where(function($query) use ($start_date, $end_date,$req_id[$i]){ $query->whereBetween('date_applied',array($start_date,$start_date)) ->orwhere('req_id', $req_id[$i]); }) ->get();
添加select query。。我认为您的表('ssrreqs')有req\u id
仍然是相同的错误,它说;语法错误,意外的“[”,应为“,”或“)”。它位于该行末尾的$end_date、$req_id[$i])add;之间req\u id