Hi everyone,
I am working on a PHP football league system but I am totally stuck with my attempts to create a league table which is somewhat vital you may think?
I am drawing in the information from a database table aptly called 'tables' with the setup like this:
id - teamid - wins - losses - draws - for - against - points - seasonid
I am getting the information from the database using:
"SELECT * FROM ".TBL_TABLE." WHERE seasonid='$season' ORDER BY points"
Simple enough (although annoyingly that orders the points from 0 upwards), but from this point I am really struggling to take that data and sort it into the correct data for the table:
So order the data collected by:
- Points
- If points equal then by goal difference
- If goal difference equal by goals for
- If goals for equal by least goals against
- If equal then alphabetical
So that I can then print out this table data, I have experimented with sort() and asort() but I am pretty confused about what is going on there. I would show you the actual code, but its a mess, and it almost definatly way off the mark in what I need to do.
Does anyone have any tips on what I need to look into to find a solution to this?
Sorry if this is really basic but I am just learning PHP right now.
Thanks, Tim