Don't know if you would be able to help me anymore possibly? I'm now trying to work the amount of wins, draws and losses each team has and place this on the league table, also the goals conceded as for some reason only the goals for calculated. Below is the code that I have used to calculate the points, goals for and goal difference headings:
$league_table = mysql_query("SELECT team,sum(goals) as goals,sum(points) as points, (difference) as difference FROM(
SELECT fixtures.hometeam as team, sum(results.homegoals) as goals,sum(results.homepoints) as points,(results.homegoals - results.awaygoals) as difference
FROM fixtures inner join results on results.fixtureteams = fixtures.fixtureid
where fixtures.leaguename='$leaguename'
group by fixtures.hometeam
union
SELECT fixtures.awayteam as team, sum(results.awaygoals) as goals,sum(results.awaypoints) as points, (results.awaygoals-results.homegoals) as difference
from fixtures inner join results on results.fixtureteams = fixtures.fixtureid
where fixtures.leaguename= '$leaguename'
group by fixtures.awayteam
) as league group by team order by points desc, difference desc");
?>