0

Good morning! I 'm trying to do a query with the 'IN' clause using 'Implode'. The problem is that whenever I return one record. Just take the first value of the array and puts it in the IN...

$array = $fields -> exports;
         $values = implode(",", $array);
         $export = Users_logs::find()
                -> where(['IN', 'Id', [$values]])
                -> all();

1 Answer 1

1

Don't use implode, pass array directly

where(['IN', 'Id', $array])

or

where(['Id' => $array]);
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much ! as I may have occurred , this works fine . Greetings!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.