i have a query that fetches form details and discards formid if already assigned to some user.

```
$formIds = DB::table('tbl_staff_user_details')
          ->select(DB::raw('GROUP_CONCAT(forms_assigned) as form_ids'))
          ->first();
$formIds = array_unique(explode(",", $formIds->form_ids));
if (Input::has('form_id'))
{
     $sql = 'SELECT * from tbl_forms where id IN('.Input::get('form_id').')';
}
else
{
     $lm_ids = Input::get('law_id');            
     $sql =  'SELECT *
              FROM tbl_forms
              WHERE lm_id IN('.$lm_ids.') AND id 
              NOT IN('.join(",",$formIds).')';
}
$data = DB::select($sql);

```

when i do `dd($formIds)` i am getting as `" "`.

and an error as:

> 
> Syntax error or access violation: 1064
>  at line 3 (SQL: SELECT \* FROM tbl\_forms WHERE lm\_id IN(1,2,3,4,5) AND
>  id NOT IN())
> 
> 
> 

how to fire `$sql` if `$formIds` is null.