The query should work, put the sql into the sql tab in phpmyadmin, change the $id for a real value and see what happens. What won't work is your use of foreach().
foreach($list as $id), $id will be the index of the $list array (the position in the array - eg 1,2,3,4,5,6 etc)
foreach($list as $key => $value), $value will be what you want while $key will be the index
You shouldn't need to run the query in a loop though, that could end up running hundreds or even thousands of queries on the sql server. On a shared host that could kill it!
Instead, something like this would be better - adjust the SQL query in a loop and then run it just once:
PHP Code:
$Where = implode(' or id = ', $list);
//SELECT * FROM SERVERS WHERE id = 1 or id = 2 or id = 3 etc
$Query = "SELECT * FROM SERVERS WHERE id = $Where";
//Run query here, no looping queries, no sql server hogging etc.
That assumes that the values of $list are all numerical. If they are string based you'll need to use singles quotes in the sql.
If your id is not numerical (eg say it has letters in it) then this would do it instead:
PHP Code:
foreach($list as $key => $value)
{
$list[$key] = "'$value'"; //Note use of single quotes
}
$Where = implode(' or id = ', $list);
//SELECT * FROM SERVERS WHERE id = 'a1' or id = 'a2' or id = 'a3' etc
$Query = "SELECT * FROM SERVERS WHERE id = $Where";