Hi all,
I hope somebody can help me. An internet search has me more confused than I probably should be.
I am working with code I use for a set of fixtures and results for a football league.
I have successfully been able so far to display all fixtures from the season on one page, ordered by date.
http://www.tainthistle.co.uk/testfolder/display.php
However, what I want to be able to do is filter the results by each team.
I know roughly what I need to do but am stumped on the code. I want to basically request that if OpponentName entry 1 is selected from the drop down, then any fixtures featuring the hometeam or awayteam of OpponentName entry 1 would be displayed on screen.
Here is my current code for the link above:
<?php
include('user.php');
$connection = mysql_connect("$host","$user","$password")
or die(mysql_error());
mysql_select_db("$txt_db_name",$connection)
or die(mysql_error());
{
$print_date = '%d.%m.%Y';
}
{
$get_matches = mysql_query("
SELECT O.OpponentName AS hometeam,
OP.OpponentName AS awayteam,
LM.LeagueMatchHomeGoals AS goals_home,
LM.LeagueMatchAwayGoals AS goals_away,
LM.LeagueMatchID AS id,
DATE_FORMAT(LM.LeagueMatchDate, '$print_date') AS date
FROM tplls_leaguematches LM, tplls_opponents O, tplls_opponents OP
WHERE O.OpponentID = LM.LeagueMatchHomeID AND
OP.OpponentID = LM.LeagueMatchAwayID AND
LeagueMatchSeasonID = '4'
ORDER BY LM.LeagueMatchDate",$connection)
or die(mysql_error());
}
while($data = mysql_fetch_array($get_matches)){
echo "
<table>
<tr>
<td align=\"left\" colspan=\"2\">
<b>$data[date]</b>
</td>
</tr>
</table>
<table>
<tr>
<td align=\"left\" valign=\"top\" width=\"90%\">$data[hometeam] $data[goals_home]-$data[goals_away] $data[awayteam]</td>
<td align=\"left\" valign=\"top\" width=\"10%\"></td>
</tr>
</table><br>";
}
?>