I have the function below that works until it gets to the for loop. It grabs the two correct scores, but when I try to add them together it gives me just the last score.
Any help is greatly appreciated.
Thanks,
Jason Martin
function GetHandicap ($player_name)
{
global $dbname;
$results=mysql($dbname,"select count(*) as count from rounds where name = '$player_name'");
$row=mysql_result($results,"count");
$results2=mysql($dbname,"select rounds_used from handicap_table where rounds = $row");
$row2=mysql_result($results2,"rounds_used");
$query = "select total as scores from rounds where name = '$player_name' order by scores asc LIMIT $row2";
$query_result_handle = mysql_query ($query);
for ($counting = 1; $row3 = mysql_fetch_row ($query_result_handle); ++$counting)
{
echo $row3[0];
// This gives me the first score - 39
echo $row3[1];
// This gives me the second score = 40
$handicap = $row3[0] + $row3[1];
// This gives me the same as $row3[1] 40. It should be 79
}
return $handicap;
}
Thanks,
Jason Martin