I'm trying to add params to the IN clause of a sql query in PHP.
The query:
$sqlQuery = <<<SQL
SELECT * FROM mytable where codes IN (:codes)"
SQL;
The params:
$params['codes'] = "'test','last'";
But this doesn't work i.e. doesn't return any results
$total = DB::select($sqlQuery, $params);
But this query run directly in the database returns results
SELECT * FROM mytable where codes IN ('test','last')
I'm guessing it has to with the parameters not being handled the same way for an IN clause, but I haven't been able to find anything about this.