building table with php

ok.. I know how to loop through an array and get the rows to build a table across the page.... that is pretty simple... but I need help creating a table on the fly that lets me pull the values and go verticle by game.. meaing the out put would looke like this (see attached gif!)

attached is the table.. its pretty straight forward... its for a soccer team. so stats tracked on the left going down verticle... and games played going across the top...

ok just one more quick question.. I pulling via mysql... all the values... min played, ext...

so each week I will get more stats based on each the number of games played.... any help on this part, but building the table part that you sent me is perfect! that is the exact way I need it to go.. its just each week I add a game... so it becomes more complex?

I am not sure that this is the most efficient way, but it is one way of doing what you're trying to achieve.
It should be fine for a small set of data, but if you are using a large data set, you would possibly want to devise a more complex set of code.