Hi,
I am developing a website for a club and I am trying to get the next games to show up.
I am trying to get some info out of one database and then use that info as a key for the next query, then display all the results that correspond to those queries. Hope that makes sense.
The code I have done so far is:
Please help, I have never done this before..
<?php
$upcomingGames=array();
$teamsSql = 'SELECT * FROM teams';
foreach ($conn->query($teamsSql) as $row) {
$teamArray[]= $upcomingTeam = $row['team'] && $upcomingRound = $row['round'] && $league = $row['league'] && $leagueURL = urlencode($row['league']) && $teamURL = urlencode($row['team']);
foreach ($conn->query("SELECT * FROM fixtures_results WHERE `team`='".$upcomingTeam."' AND `round`='".$upcomingRound."'") as $gameRow) {
$upcomingGames[]=<<<END
<tr>
<td><div class="upcomingGamesLeague"><a href="fixtures.php?leagueName=$leagueURL&teamName=$teamURL">$league:</a></div></td>
<td><div class="upcomingGamesTeams"><a href="http://$gameRow[home_team].site.com.au" target="_blank">$gameRow[home_team]</a> V <a href="http://$gameRow[away_team].site.com.au" target="_blank">$gameRow[away_team]</a></div></td>
<td><div class="upcomingGamesDate">$gameRow[day] $gameRow[date] $gameRow[time]</a></div></td>
</tr>
END;
}
}
$upcomingGames=implode("\r\n",$upcomingGames);
?>
Thanks,
Cheers,
QWaz