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
SQL can't parse PHP arrays. Try this:
$query="SELECT * FROM posts WHERE user_id IN ({implode(',', $userIDarray)})";
Yea you will have to you use following syntax
SELECT 'value'
IN (array)
Take a look at this page : WHERE ... IN. You can use the IN operator to check if a certain value exists within an list of values.
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()