0

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

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by rajarajan07
0

If you are going to fetch a single field from first query or one more values?
If a single value:

Then store it in a $infokey="that value";

Then pass it to another query: "select * from nextQuery where field=$infokey"

This is somewhat I understand!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.