<?
$hole=0;
do {
$hole=$hole+1;
$table="hole$hole";
//lets get par4 and par5 stats
$statsql="Select * from $table
where userid = '$login_id' and (par='4' or par='5') and (gameid='$gameid')";
$statquery=mysql_query($statsql);
$statrow=mysql_fetch_array($statquery);
$statexist=mysql_numrows($statquery);
if ($statexist) {
do {
extract($statrow);
//this is for distance
if ($drive_distance <> "na") {
$total_drive=$total_drive+1;
$total_drive_distance=$total_drive_distance+$drive_distance;
} //endif drive distance <> na
//2.this is for fways hit
$total_fairways_hit=$total_fairways_hit+$fairway_hit;
} while ($statrow=mysql_fetch_array($statquery));
} //endif statexist
$poss_fairways=$poss_fairways+$statexist;
//23. Find scrambling!
$stat11sql="Select * from $table
where userid = '$login_id'
and (gross_name='Birdie' or gross_name='Par' or gross_name='Eagle' or gross_name='Double Eagle' or gross_name='Hole in One')
and gir=0 ";
$stat11query=mysql_query($stat11sql);
$stat11row=mysql_fetch_array($stat11query);
$stat11exist=mysql_numrows($stat11query);
$scrambled_holes=$scrambled_holes+$stat11exist;
//33. Find net scrambling!
$stat12sql="Select * from $table
where userid = '$login_id'
and (net_name='Birdie' or net_name='Par' or net_name='Eagle' or net_name='Double Eagle' or net_name='Hole in One')
and gir=0 ";
$stat12query=mysql_query($stat12sql);
$stat12row=mysql_fetch_array($stat12query);
$stat12exist=mysql_numrows($stat12query);
$net_scrambled_holes=$net_scrambled_holes+$stat12exist;
###############
$stat2sql="Select * from $table
where userid = '$login_id'";
$stat2query=mysql_query($stat2sql);
$stat2row=mysql_fetch_array($stat2query);
$stat2exist=mysql_numrows($stat2query);
if ($stat2exist) {
do {
extract($stat2row);
//3.this is for gir
$total_gir=$total_gir+$gir;
//4.this is for total putts
if ($putt <> "na") {
$total_putts2=$total_putts2+$putt;
$total_holes_putt=$total_holes_putt+1;
} //endif drive distance <> na
//7.Scoring Average. Find out the total gross
$total_gross=$total_gross+$gross;
//11.Net Scoring Average. Find out the total net
$total_net=$total_net+$net;
//14.this is for total par 3 holes AND PAR 3 BIRDIES AND PARS FOR gross and net
if ($par == 3) {
$total_par3=$total_par3+1;
$total_par3_scores=$total_par3_scores+$gross;
$net_par3_scores=$net_par3_scores+$net;
if ($gross_name == "Birdie") {
$par3_birdies=$par3_birdies+1;
}
if ($gross_name == "Par") {
$par3_pars=$par3_pars+1;
}
if ($net_name == "Birdie") {
$net_par3_birdies=$net_par3_birdies+1;
}
if ($net_name == "Par") {
$net_par3_pars=$net_par3_pars+1;
}
} //endif
//15.this is for total par 4 holes AND PAR 4 BIRDIES AND PARS FOR gross and net
if ($par == 4) {
$total_par4=$total_par4+1;
$total_par4_scores=$total_par4_scores+$gross;
$net_par4_scores=$net_par4_scores+$net;
if ($gross_name == "Birdie") {
$par4_birdies=$par4_birdies+1;
}
if ($gross_name == "Par") {
$par4_pars=$par4_pars+1;
}
if ($net_name == "Birdie") {
$net_par4_birdies=$net_par4_birdies+1;
}
if ($net_name == "Par") {
$net_par4_pars=$net_par4_pars+1;
}
} //endif
//16.this is for total par 5 holes AND PAR 3 BIRDIES AND PARS FOR gross and net
if ($par == 5) {
$total_par5=$total_par5+1;
$total_par5_scores=$total_par5_scores+$gross;
$net_par5_scores=$net_par5_scores+$net;
if ($gross_name == "Birdie") {
$par5_birdies=$par5_birdies+1;
}
if ($gross_name == "Par") {
$par5_pars=$par5_pars+1;
}
if ($net_name == "Birdie") {
$net_par5_birdies=$net_par5_birdies+1;
}
if ($net_name == "Par") {
$net_par5_pars=$net_par5_pars+1;
}
} //endif
} while ($stat2row=mysql_fetch_array($stat2query));
} //endif stat2exist
$total_holes=$total_holes+$stat2exist;
//5.This is to find eagles for gross
$stat3sql="Select * from $table
where userid = '$login_id'
and gross_name='Eagle' ";
$stat3query=mysql_query($stat3sql);
$stat3row=mysql_fetch_array($stat3query);
$stat3exist=mysql_numrows($stat3query);
//$total eagles
$total_eagles=$total_eagles+$stat3exist;
//6.This is to find birdies
$stat4sql="Select * from $table
where userid = '$login_id'
and gross_name='Birdie' ";
$stat4query=mysql_query($stat4sql);
$stat4row=mysql_fetch_array($stat4query);
$stat4exist=mysql_numrows($stat4query);
//$total birdies
$total_birdies=$total_birdies+$stat4exist;
//7.This is to find pars
$stat5sql="Select * from $table
where userid = '$login_id'
and gross_name='Par' ";
$stat5query=mysql_query($stat5sql);
$stat5row=mysql_fetch_array($stat5query);
$stat5exist=mysql_numrows($stat5query);
//$total pars
$total_par=$total_par+$stat5exist;
//10.This is to find eagles for net
$stat7sql="Select * from $table
where userid = '$login_id'
and net_name='Eagle' ";
$stat7query=mysql_query($stat7sql);
$stat7row=mysql_fetch_array($stat7query);
$stat7exist=mysql_numrows($stat7query);
//$total eagles
$net_total_eagles=$net_total_eagles+$stat7exist;
//11.This is to find birdies
$stat8sql="Select * from $table
where userid = '$login_id'
and net_name='Birdie' ";
$stat8query=mysql_query($stat8sql);
$stat8row=mysql_fetch_array($stat8query);
$stat8exist=mysql_numrows($stat8query);
//$total birdies
$net_total_birdies=$net_total_birdies+$stat8exist;
//12.This is to find pars net
$stat9sql="Select * from $table
where userid = '$login_id'
and net_name='Par' ";
$stat9query=mysql_query($stat9sql);
$stat9row=mysql_fetch_array($stat9query);
$stat9exist=mysql_numrows($stat9query);
//$total pars
$net_total_par=$net_total_par+$stat9exist;
/*
//14.This is to find par 3 birdies
$stat10sql="Select * from $table
where userid = '$login_id'
and gross_name='Birdie'
and par=3 ";
$stat10query=mysql_query($stat10sql);
$stat10row=mysql_fetch_array($stat10query);
$stat10exist=mysql_numrows($stat10query);
//$total par 3 birds and par 3 holes
$total_birdies=$total_birdies+$stat10exist;
*/
} while ($hole<18);
$missed_gir=$total_holes-$total_gir;
?>