I want to write a MySQL statement like:
SELECT * FROM someTable WHERE someId IN (value1, value2, value3, ...)
The trick here is that I do not know ahead of time how many values there will be in the IN().
Obviously I know I can generate the query on the go with string manipulations, however since this will run in a loop, I was wondering if I could do it with a PDO PreparedStatement.
Something like:
$query = $PDO->prepare('SELECT * FROM someTable WHERE someId IN (:idList)');
$query->bindValue(':idList', implode(',', $idArray));
Is that possible?