here is what MySQL returns in a visual way..
game_id | team_id | stat_id
1 | 1 | 1
1 | 2 | 3
1 | 3 | 7
1 | 3 | 6
2 | 1 | 1
2 | 4 | 3
here is what I know
in records with the same game_id, there will be no repeating team_id
in records with the same team_id, there will be no repeating stat_id
so, after I got the query, I made them into this format
$data['$rownumber']['game_id']
$data['$rownumber']['teat_id']
$data['$rownumber']['stat_id']
but now, I want turn it into this format
we assume $int_1 and $int_2 could be any interger
$data['$rownumber']['game_id'];
$data['$rownumber'][$int_1]['team_id'];
$data['$rownumber'][$int_1][$int_2]['stat_id'];
and the requirement is, in the array of $data['$rownumber'], there will be only different team_id that belong to the game_id of $data['$rownumber']. and each $data['$rownumber'][$int_1][$int_2]['stat_id'] need to be belong to $data['$rownumber'][$int_1][$team_id']
any one got a way to do that because I have already drained my mind and only get as far as making them into
$data[$'rownumber']['game_id'];
$data['$rownumber'][$int_1]['team_id'];
$data['$rownumber'][$int_1]['stat_id'];
for example, this
$data[1]['game_id'] = 1;
$data[1]['team_id']= 1;
$data[1]['stat_id'] =1;
$data[2]['game_id'] = 1;
$data[2]['team_id'] = 1;
$data[2]['stat_id'] =2;
$data[3]['game_id'] =1;
$data[3]['team_id'] =2;
$data[3]['stat_id'] =3;
will be into this
$data[1]['game_id'] =1
$data[1][1]['team_id'] = 1;
$data[1][1][1]['stat_id'] =1;
$data[1][1][2]['stat_id'] =2;
$data[1][2]['team_id'] = 2;
$data[1][2][1]['stat_id'] = 3;
and my brain are buring right now 🙁, please some one help me
btw, would converting a larger group
(say, 50 rows, each game id refer to 4 teams, each team refer to 2 stats)
taking a very long time(like... more than 3 seconds)
thx