Ok Brad got all of that working with the exception of the last point.
I've updated the code to initialize the variables as follows:
$bonusGROUPED='';
$pointsGROUPED='';
$totalpointsGROUPED='';
$playedGROUPED='';
$GBPCPoints='';
$totalpoints33GROUPED='';
foreach ($arr as $key => $row) { // THIS SECOND LOOP BUILD AN ARRAY FOR EACH PRSON AT EACH VENUE
// ADDING THE POINTS FOR EACH VENUE AND ADDING THE NUMBER OF TIMES
// PLAYED AT EACH VENUE. BEAUTY
$bonusGROUPED[$row[1].$row[2].$row[3]] = $bonusGROUPED[$row[1].$row[2].$row[3]] + $row[4] + $row[5]; //grouped data with bonus chips
$pointsGROUPED[$row[1].$row[2].$row[3]] = $pointsGROUPED[$row[1].$row[2].$row[3]] + $row[6]; //creates grouped data for each player with points
$totalpointsGROUPED[$row[1].$row[2].$row[3]] = $totalpointsGROUPED[$row[1].$row[2].$row[3]] + $row[4] + $row[5] + $row[6];//creates grouped data for each player with points
$playedGROUPED[$row[1].$row[2].$row[3]] = $playedGROUPED[$row[1].$row[2].$row[3]] +1; //creates grouped data for number of times played
$GBPCPoints = $totalpoints33GROUPED[$row[1].$row[2].$row[3]] * $average_by_venue[$row[3]] / 20; // calculates number of chips
$CHIPS = ceil($GBPCPoints / 25) * 25; //rounds up chipstack to nearest 25
$arrGROUPED[$row[1].$row[2].$row[3]] = array(1 => $row[1], 2 => $row[2], 3 => $row[3], 4 => $bonusGROUPED[$row[1].$row[2].$row[3]], 5 =>$pointsGROUPED[$row[1].$row[2].$row[3]], 6 => $totalpointsGROUPED[$row[1].$row[2].$row[3]], 7 => $playedGROUPED[$row[1].$row[2].$row[3]], 8 =>$CHIPS); //creates new array combining all the above data
}
But now I get this error on line 113 to 117 instead:
Notice: Uninitialized string offset: 0 in C:\web\gbpc\includes\finalists.php on line
Which are these lines here :
$bonusGROUPED[$row[1].$row[2].$row[3]] = $bonusGROUPED[$row[1].$row[2].$row[3]] + $row[4] + $row[5]; //grouped data with bonus chips
$pointsGROUPED[$row[1].$row[2].$row[3]] = $pointsGROUPED[$row[1].$row[2].$row[3]] + $row[6]; //creates grouped data for each player with points
$totalpointsGROUPED[$row[1].$row[2].$row[3]] = $totalpointsGROUPED[$row[1].$row[2].$row[3]] + $row[4] + $row[5] + $row[6];//creates grouped data for each player with points
$playedGROUPED[$row[1].$row[2].$row[3]] = $playedGROUPED[$row[1].$row[2].$row[3]] +1; //creates grouped data for number of times played
$GBPCPoints = $totalpoints33GROUPED[$row[1].$row[2].$row[3]] * $average_by_venue[$row[3]] / 20; // calculates number of chips
Any idea where I'm going wrong here?
Thanks a million 🙂
PS. this is the array:
while($r = mysql_fetch_array($result)){ // THIS FIRST LOOP CALLCULATES THE CHIP STACK FOR EACH RESULTw
//AND BUILDS ARRAY.
$arr[] = array(1 => $r[1], 2 => $r[2], 3 => $r[3], 4 => $r[4], 5 => $r[5], 6 => $r[6], 7 => $r[7]);
// array values are [1]Player.FirstName , [2]Player.LastName, [3]Venue.VenueName as Venue, [4]Results.MemCard, [5]Results.EarlyReg, [6]Position.Points as Venue_Points, [7]Results.Date