Inside the foreach loop you have declared a variable and for each loop that is declared and assigned the same value and so it shows the same data always.