i never tried this, but i think I know what you are trying to achieve.
the problem seems to be in 2 parts,
Storing the id's in an array
Retrieving the array values and using them as parameters for your select statement
first off, i would focus on building the array and ensuring that this part works
then i would create the select statement (with a variable $string or whatever) and build $string by looping through the array, with the intention of ending up with lots of 'OR' values as your criterial,
SELECT ... FROM ... WHERE ID = 1 OR 2 OR 3
does that make sense ?
here are some good tutorials on php arrays to help