View Single Post
Old 07-14-2009, 07:16 PM   #2 (permalink)
adamdecaf
The Addict
 
Join Date: May 2009
Posts: 287
Thanks: 5
adamdecaf is on a distinguished road
Default

Nice job so far, you could output the data like so:

PHP Code:
<?php
// rem: $studentinfo

// Set the teams
   
$green;
   
$red;
   
$blue;

   foreach (
$studentinfo as $student) {
      switch(
strtolower($student[0])) {
         case 
'green team':
             
$green += $student[1];
         break;

         case 
'blue':
             
$blue += $student[1];
         break;

         case 
'red':
             
$red += $student[1];
         break;

         default:
             
// Nothing, or you can add points to an extra team.
         
break;
      } 
   }

?>
This code would require that the totals in $student[1] were correct (It looks like your projected output is a "correct" total, mine is not). To fix it you would need to tally up the totals (from the excel sheet) before you would add them to the final score.
__________________
My Site
adamdecaf is offline  
Reply With Quote