Below is a function that I am trying to get working. The first two queries in the function work (I know this because I echoed there values), but the 3rd part of the function just doesn't work. It grabs the correct data from the query, but I can't add the variables together that it retrieves.
Basically all I want to do is add all of the values together that this query retrieves & divide by the result of another variable that is retreived earlier in the function.
Any help is greatly appreciated.
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);
// This is where the trouble begins
while ( $row3 = mysql_fetch_row($query_result_handle)) {
echo "$row3[0] + $row3[1] = " . ($row3[0] + $row3[1]) . "<br>";
$handicap = $row3[0] + $row3[1];
// This part of the function gives this result:
// 39 + = 39
// 40 + = 40
// 40
}
return $handicap
}