- Member | 24
I have this code:
$id = 2; $ids = [2, 3, 4]; $query = "INSERT INTO a (a,b) SELECT a,?, b FROM b WHERE a.id IN (?)"; $this->database->query($query, $id, $ids);
and when I try tu run it i get
Automaticaly detected multi-insert, but values aren't array. If you need try to change mode like "?[and|or|set|values|order]". Mode "values" was used.
When i change it to
$query = "INSERT INTO a (a,b) SELECT a,".$id.", b FROM b WHERE a.id IN (" . implode(',', $ids) . ")"
it's working. Am I doing something wrong, or is this preprocessor issue?