hey all

Now i have been trying to figure this our for ages, and its just not coming to me :/
Heres the scenario, i am creating a flatfile points system for a school.
all information is read from an excel file, points are generated from an algorithm i created and the points per student are outputted, there is an output generated below:
i cant figure out how to just display the team and the teams overall points.
Quote:
Name ID Attendance Milestone Actual Assessment R1 R2 R3 Team Points
Student1 1 90 4a 4a 1 0 0 Blue Team 16
Student2 2 75 5b 5c 2 1 1 Red Team 14
Student3 3 95 5c 3b 0 0 0 Blue Team 15
Student4 4 100 5a 6b 1 2 1 Blue Team 40
Student5 5 100 4b 4c 0 0 1 Green Team 30
Student6 6 65 6c 6a 0 1 0 Red Team 17
Student7 7 96 4a 5a 1 0 1 Green Team 26
Student8 8 98 3b 3a 1 2 2 Green Team 45
|
So i want to output something simple like this:
Quote:
Green Team Overall Points: 150
Red Team Overall Points: 127
Blue Team Overall Points: 89
|
the furthest i got, was giving each student an array with points and team name..
PHP Code:
// This skips the headings
$i = 2;
// Create an array
$studentinfo = array();
while ($i <= $rowsc)
{
// Student
$no = $i++;
// Students ID
$id = $data->val($no,2);
// The Team they belong too
$team = $data->val($no,9);
// There overall points, which is grabbed from elsewhere
$r3 = "$overalladded";
// Creating the array..
$studentinfo[$id] = array("$team","$r3");
}
// I tried something with this, but didn't get very far
//$unique_teams_array = array_unique($studentinfo);
//ksort($studentinfo);
// Output
echo"<pre>";
print_r($studentinfo);
echo"</pre>";
which outputted:
PHP Code:
Array
(
[1] => Array
(
[0] => Blue Team
[1] => 0
)
[2] => Array
(
[0] => Red Team
[1] => 1
)
[3] => Array
(
[0] => Blue Team
[1] => 0
)
[4] => Array
(
[0] => Blue Team
[1] => 1
)
[5] => Array
(
[0] => Green Team
[1] => 1
)
[6] => Array
(
[0] => Red Team
[1] => 0
)
[7] => Array
(
[0] => Green Team
[1] => 1
)
[8] => Array
(
[0] => Green Team
[1] => 2
)
)
side notes:
i am using
http://code.google.com/p/php-excel-reader/ to read the excel file.