Hi I’ve had some code written for me but it doesn’t do exactly what I need, I think I’m pretty much there with sorting it, but there is one last variable I cannot print/echo to the table!!
here is the code including the mysql query:
[php] $gamePerVenueRes = mysql_query(“select result.*,Position.Points,sum(Position.Points) TotalPoints,sum(extraBonus) as extraBonus,count(result.MembershipNo) Totalgame from (SELECT Results.MembershipNo,FirstName,LastName,ResultID,VenueID,Date as gameDate,Position,MemCard,EarlyReg,ABS(MemCard+EarlyReg) as extraBonus FROM Player left join Results on Player.MembershipNo=Results.MembershipNo where Results.Date
BETWEEN ‘$BeginDate’ AND ‘$EndDate’ and VenueID=” . $venueRows[‘VenueID’] . " ) result join Position on result.Position=Position.Position group by result.MembershipNo order by result.MembershipNo");
while ($eachUserRow = mysql_fetch_assoc($gamePerVenueRes)) {
$eachUserRow['VenuePoints']=$eachUserRow['TotalPoints']+$eachUserRow['extraBonus'];
//Venue points + bonus
$perPlayer[$eachUserRow['MembershipNo']]['overAllGame']+=$eachUserRow['Totalgame'];
//Number of games played
$perPlayer[$eachUserRow['MembershipNo']]['GamesPlayedBonus'] = $perPlayer[$eachUserRow['MembershipNo']]['overAllGame'] * 100;
//Games played x 100
//echo $perPlayer[$eachUserRow['MembershipNo']]['GamesPlayedBonus'] . " (GP) - ";
$eachUserRow['WeightedVenuePoints'] = $eachUserRow['VenuePoints'] * ($gamePerVenueDate[$venueRows['VenueID']]['venue']['Average'] + $gamePerVenueDate['overallAvg']);
//Weighted Venue Points
//echo $eachUserRow['WeightedVenuePoints'] . " (WVP) - ";
$eachUserRow['Chips']= $eachUserRow['WeightedVenuePoints']+2500+$perPlayer[$eachUserRow['MembershipNo']]['GamesPlayedBonus'] ;
//getting highest weighted points
//echo $eachUserRow['Chips'] . " (CHIP) / ";
if (array_key_exists('highestChipStack', $perPlayer[$eachUserRow['MembershipNo']])) {
if ($eachUserRow['WeightedVenuePoints'] > $perPlayer[$eachUserRow['MembershipNo']]['highestChipStack']['Chips']) {
$perPlayer[$eachUserRow['MembershipNo']]['highestChipStack'] = array('venueId' => $venueRows['VenueID'], 'weightedPoint' => $eachUserRow['WeightedVenuePoints']);
}
} else {
$perPlayer[$eachUserRow['MembershipNo']]['highestChipStack'] = array('venueId' => $venueRows['VenueID'], 'weightedPoint' => $eachUserRow['WeightedVenuePoints']);
// print_r($perPlayer[$eachUserRow['MembershipNo']]['highestChipStack']);
}
//end for getting highest point
$perPlayer[$eachUserRow['MembershipNo']][$venueRows['VenueID']] = $eachUserRow;
$userListingArray[$eachUserRow['MembershipNo']] = $perPlayer[$eachUserRow['MembershipNo']]['highestChipStack']['weightedPoint'];
//echo $userListingArray[$eachUserRow['MembershipNo']];
}
}
//$gamePerVenueDate['TotalBonusPoint'] = $bonusPoint * 100;
arsort($userListingArray);[/php]
The bit I can’t echo to the table is:[php]LINE 21 ABOVE: $eachUserRow[‘Chips’]= $eachUserRow[‘WeightedVenuePoints’]+2500+$perPlayer[$eachUserRow[‘MembershipNo’]][‘GamesPlayedBonus’] ;[/php]
This is the Table and variables:
[code] $firstName = $perPlayer[$membershipId][$venueId][‘FirstName’];
$lastName = $perPlayer[$membershipId][$venueId][‘LastName’];
$venuePoints = ceil($perPlayer[$membershipId][$venueId][‘VenuePoints’]);
$totalGames=$perPlayer[$membershipId]['GamesPlayedBonus'];
$VenueName = $gamePerVenueDate[$venueId]['venue']['VenueName'];
$chips = $eachUserRow['Chips'];
?>
<tr height="30">
<td align="center" <?php echo $style; ?>>
<?php echo $pos; ?>
</td>
<td align="center" <?php echo $style; ?>>
<a href="playerDates.php?FName=<?php echo $firstName; ?>&LName=<?php echo $lastName; ?>">
<?php echo $firstName . ' ' . $lastName; ?>
</a>
</td>
<td align="center" <?php echo $style; ?>>
<a href="venueDates2.php?VenueName=<?php echo $VenueName; ?>">
<?php echo $VenueName; ?>
</a>
</td>
<td align="center" <?php echo $style; ?>>
<?php echo $venuePoints; ?>
</td>
<td align="center" <?php echo $style; ?>>
<?php echo $WVP; ?>
</td>
<td align="center" <?php echo $style; ?>>
<?php echo $totalGames; ?>
</td>
<td align="center" <?php echo $style; ?>>
<?php echo $chips; ?>
</td>
</tr>[/code]
When I display the page the chips column is blank, but everything else works! If I uncomment line 23, it shows the values in £Chips correctly.
Anyone got any ideas where I’m going wrong here??
Any and all help would be very appreciated
Cheers