Hi,

I am trying to display some results where one column is equal to another column in a table.

End goal:
display all the results where the round and current round are the same number for every team in the table. the number of teams will change as the number can be added to or deleted.

Here is what I have done so far, however I am getting the error:

Warning: Invalid argument supplied for foreach() in C:\Users\...\index.php on line 34 .... which is line 2 in the code...

$upcomingGames=array();
	$upcomingSql = "SELECT * FROM fixtures_results WHERE `round`==`current_round`";
		foreach ($conn->query($upcomingSql) as $gameRow) {
			$teamURL = str_replace(" ","+",$gameRow['team']);
			$leagueURL = str_replace(" ","+",$gameRow['league']);
			$upcomingGames[]=<<<END
			<tr>
			<td><div class="upcomingGamesLeague"><a href="fixtures.php?leagueName=$leagueURL&teamName=$teamURL">$gameRow[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);

SO how do I get the results for each team where the round and current_round equal the same number?

thanks for your help.

Cheers,

QWaz

Dont worry I solved my own problem.

I needed to use a different Comparison Function in my MySQL Statement:

This worked:

"SELECT * FROM fixtures_results WHERE `round`<=>`current_round`";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.