The reason I can't do an ORDER BY in my select statement is because I'm querying several tables and the resulting set (that needs to be sorted) is summed on several fields within the PHP program. I can't sum them in my query, because I need the individual values to compute a seperate value. It might be better to illustrate what I'm trying to do with pseudocode.
1. Read in player header record based on criteria.
2. For each player record, read multiple records from weekly_stats.
3. Each week, calculate the points based on the stats.
4. Sum the stats and points so that the grand totals can be put with the player information to form one record with the player's info and year to date stats.
5. Put this record into an array (thus forming a multi-dimensional array)
6. Repeat steps 2-5 for each player.
7. Resulting data needs to be sortable on all fields.
The main snag is calculating the points on a weekly basis. Calculating on the totals will yield a different result otherwise I would have done everything in one SQL query.
I only listed a very simplified snipet of code to illustrate what my array looks like