I want to know is this practically possible in sql(using php as server-side), where in you have an array of values(numbers), and you try to retrieve data based on values ins
Yes, this is easily possible. You need to look at MySQL's IN function
Your query would be something like
SELECT * FROM posts WHERE user_id IN (1,2,3,4,5,6)
You can build the bit in between the parentheses in PHP using implode()