Is there any way to modify this solution to work for a situation in which the original array has duplicates but you still want to get a reply from the database? In other words, if the array looks like this:
$array = array(1,2,1,2,1,2);
and you follow it with this:
$sql = 'SELECT * FROM table WHERE field IN(' . implode(',', $array) . ')';
MySQL only gives one match for 1 and one match for 2. Is there a way to modify the php to make it match every time? Is there a way to make null values in the array return as null from the database?