Answer the question
In order to leave comments, you need to log in
How to pass in preparedstatement query to mysql an array of values in IN()?
Query example: SELECT users FROM table WHERE id IN(?)
Googling found a discussion of the problem stackoverflow.com/questions/178479/preparedstateme...
from which it becomes clear that without crutches, you simply cannot substitute an array.
The answers are dated 2-3 years ago, maybe there is a solution at the moment?
Or it remains only to generate a preparedstatement with the necessary amount of IN(?,?,?....) for each request?
Answer the question
In order to leave comments, you need to log in
Everything is done the same way.
And this is done in just a couple of lines.
$bind = ['somebind'];
$places = implode(', ', array_fill(0, count($bind), '?'));
$sqlpartial = " where column IN ($places) ";
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question