I'm trying to get a MySQL query similar to this one to work using PHP and PDO
select user_id from users where user_id in (7,8,9)
If I do this:
$userlist ='7,8,9';
$stmt->bindValue(':userlist', $userlist, PDO::PARAM_STR);
The MySQL server log records:
2016-01-27T16:51:52.644453Z 32 Prepare select user_id from users where user_id in (?)
2016-01-27T16:51:52.644489Z 32 Execute select user_id from users where user_id in ('7,8,9')
And only the row where user_id is 7 is returned.
If I do this:
$userlist ='7,8,9';
$stmt->bindValue(':userlist', (int)$userlist, PDO::PARAM_INT);
MySQL logs this:
2016-01-27T16:54:09.110990Z 33 Prepare select user_id from users where user_id in (?)
2016-01-27T16:54:09.111026Z 33 Execute select user_id from users where user_id in (7)
And again I only see one of three rows. I feel this must have a very basic solution, but I've not been able to find it..