$query="SELECT * FROM users WHERE ";
foreach($users as $name)
$query="SELECT * FROM users WHERE name='$name'";
//Push the rows you have found to the foundRows array declared above
Hope it gives you an idea. But I think this solution will be ineffiecient if the array has so many users e.g 10,000
You can also do this in a single query, instead of looping to make multiple queries. Just implode
// glue them together with ', '
$userStr = implode("', '", $users);
$query="SELECT * FROM users WHERE name in ('$userStr')";
With the 'glue' we use, this produces a where clause that looks like this: WHERE name in ('Vito', 'Joey', 'Vinny'). The starting and ending single quote in the query wraps them all so the syntax is correct.