Closed gggglglglg closed 3 years ago
You have defined $ids
as string, which is considered a single value. Try passing it as an array.
Alternatively, you can do something like this.
$ids = array(1,5,8);
$database->select("items", "*", [
"group" => $ids
]);
// Generated SQL
SELECT * FROM 'items' WHERE 'group' IN (1, 5, 8)
@ermaxinc .. Well, as explained above, your $ids is a string. convert it to an array like; $ids = "1,5,8"; $ids = explode(",", $ids)
Opinion :: Also for easy code readability, try not to mix SQL normal statements into Medoo's
SQL:
SELECT * FROM items WHERE 'group' IN ('1,5,8') <-- with quotes '1,5,8'
Need SQL:
SELECT * FROM items WHERE 'group' IN (1,5,8)
HOW?