foreach loop create table