I’m trying to convert a mysql_query statement that had the following in it to PDO:
$string = '2, 3, 4, 5, 7, 8';
mysql_query(" ... IN($string) ...");
This works fine with the mysql_query statement, but it will not work with PDO prepare and execute (no results are returned).
What am I missing here?
If the query sql works fine with
mysql_query, then it will work fine with pdo.What will not work is if you bind the whole string with just one placeholder.
You need to bind for each values for the
INclause.Example: