我正在制作一个显示不同游戏的支架。我想做一个查询,然后根据轮次将数组拆分为新数组。
我目前得到这样的所有结果:
$result = $mysqli->query("SELECT t1.name as team1, t2.name as team2, s.round, s.score_team_1, s.score_team_2 FROM scores s
LEFT JOIN teams t1 on s.team_id_1 = t1.team_id
LEFT JOIN teams t2 on s.team_id_2 = t2.team_id
WHERE s.cup_id = '1'
ORDER BY s.round ,s.game DESC")or die(mysql_error());
if($result->num_rows > 0)
{
$rounds = array('1','2','3','4','5'); //no $ symbol
while($rs = $result->fetch_assoc())
{
print_r($rs);
}
}
我想将此数组拆分为单独的数组,以便将与第 1 轮匹配的所有行放入第 1 轮的数组中,将第 2 轮的行放入第 2 轮数组中,依此类推。有谁知道我该怎么做?