fixed error :Warning: Invalid argument supplied for foreach()