我有两个SQL查询。用户和团队例如,总共三个用户。两个用户在同一个团队中,另一个用户在一个单独的团队中。我想创建一个包含团队下的用户的数组。但这键是团队的名称,因为有用户要来。
$ teamValue ['team name'],如果输入,则为同一用户。但是,如果我将$ user Value ['team name']用户写为不同的用户,但是这次,团队价格和数字是相同的。
$teamUser = array();
foreach ($userDataArr as $userValue) {
foreach ($teamDataArr as $teamValue) {
$teamUser[$teamValue['team_name']] = array(
'team_count' => $teamValue['team_count'],
'team_amount' => $teamValue['team_amount'],
'users' => array(
[
'first_name' => $userValue['first_name'],
'last_name' => $userValue['last_name'],
'user_count' => $userValue['user_count'],
'user_amount' => $userValue['user_amount']
]
)
);
}
}