I think maybe your sql statement is incorrect, you are passing in literally the statement
select n from test where s='{$arr[i]}'
Where you may want to try
$sql="select n from test where s='".$arr[i]."' ";
Separate the php part from the string.
Unless the {} part does that, i am nto that well versed in php =D
Craig
2010-02-03 02:46:26