1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| $sql = "SELECT t.team_id, t.team_id, t.team_name
FROM matchs AS m, teams AS t
WHERE t.team_id = m.team1";
$result = mysql_query($sql, $base_id);
if (mysql_num_rows($result) != 0)
{
while ($row = mysql_fetch_array($result))
{
$team1_playing[] = array($row['team_id'], $row['team_name']);
}
mysql_free_result($result);
$sql = "SELECT m.match_id, t.team_id, t.team_name
FROM matchs AS m, teams AS t
WHERE t.team_id = m.team2";
$result = mysql_query($sql, $base_id);
$i = 0;
while ($row = mysql_fetch_array($result))
{
$team2_playing[] = array($row['team_id'], $row['team_name']);
$template->assign_block_vars('row', array(
'ID' => $row[$cat1 . '_id'],
'NAME' => rawurldecode($team1_playing[$i][1]) . ' - ' . rawurldecode($team2_playing[$i][1]),
));
$i++;
}
mysql_free_result($result);
$teams_playing = array_merge($team1_playing, $team2_playing); |
Partager