syntax error in foreach statement