I teach debate at my school and i was wanting to create a way of posting team scores from each match.

The part I am having trouble at is the rank. What i want to do is to rank each set of points ( FOO & BAR ). Then use the rank from each set ( Foo rank & Bar Rank ) as a score for that teams set then tally them up for a final score for that match. Then each match will be added up for a final score.

TEAM   FOO   Foo Rank  BAR  Bar Rank  Total
------+-----+---------+----+--------+------
 You     2      1       5      2        3
 Me      6      3       3      1        4
 Them    4      2       7      3        5

I have mySQL set up for each match as:

Match ID | Team 1 | Team 2 | Team 3| FOO 1 | FOO 2| FOO 3| FOO Rank 1 | FOO Rank 2 | FOO Rank 3 | 
----------+--------+--------+-------+-------+------+------+------------+------------+------------+
      1   |  You   |   Me   | Them  |   2   |   6  |   4  |            |            |            |
----------+--------+--------+-------+-------+------+------+------------+------------+------------+

I was wondering is it possible for me to take the points from FOO scores (1-3), rank them then record there rank in the corresponding slot (Foo Rank 1-3)? If so how? If not what is a better way?

I don't see the need to record rank in your database table because you can calculate it from the scores, right? Plus I would not put the teams in different columns on one record because that makes it difficult to write queries on the data. I think a table like the following would save all the data that you need to calculate totals and rank:

mysql> select * from scores;
+----------+------+-----+-----+
| match_id | team | FOO | BAR |
+----------+------+-----+-----+
|        1 |    1 |   2 |   5 | 
|        1 |    2 |   6 |   3 | 
|        1 |    3 |   4 |   7 | 
+----------+------+-----+-----+
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.