DO not change the query value while looping