I have an array with topics and which I generate attributes to add to the query and to the bind_param:
$arr = explode(',', $theme);
$strMarcas = str_repeat('?,', count($arr) - 1) . '?';
$strTipos = str_repeat('s', count($arr));
For example usage:
WHERE main_cover in ($strMarcas)
And in the bind_param:
$stmt->bind_param($strTipos, ...$arr);
Now the problem is that I need to pass other conditions to the WHERE example:
WHERE main_cover in ($strMarcas) AND language=? AND active=?
And, I don't know how to pass the conditions, I already tried this:
$stmt->bind_param($strTipos . "si", ...$arr, $language, $active);
And, that generates this error:
Fatal error: Cannot use positional argument after argument unpacking