Ankit Sompura Ankit Sompura - 1 year ago 204
PHP Question

Laravel whereIn with a where clause ErrorException in Grammar.php line 118:

Below is my laravel query:

$statusCondition = '[1]';

$users = DB::table('user_tracking')
->join('user_detail', 'user_tracking.user_id', '=', '')
->select('user_tracking.*', 'user_detail.gender', 'user_detail.username', 'user_detail.auth_provider')
->where('user_tracking.visit_start_date','>',DB::raw('NOW()-INTERVAL 24 HOUR'))

When I'm using whereIn then given below error can anyone help to resolved such issue:

ErrorException in Grammar.php line 118: Argument 1 passed to Illuminate\Database\Grammar::parameterize() must be of the type array, string given, called in /var/sites/l/ on line 315 and defined

Answer Source

$statusCondition should be an array.


$statusCondition = '[1]';


$statusCondition = [1];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download