Location: PHPKode > projects > GolfstatsPHP > golfstatsphp_3.0/scorecard.php
<?

include("dbasecon.inc.php");

include("session.inc.php");

include ("header.php");

include ("score_functions.inc.php");

include ("userfunctions.inc.php");


if ($login_id <> "$guestid") {



//first we format the date!

$gamedate="$year-$month-$day";

//first get the game_id

$gamedate2=str_replace("-", "", "$gamedate");





$gameid = $gamedate2.$courseid;



//we need some functions here to count GIR and check putts are valid

if ($calculate) {

$hole=0;





do {

$hole++;

$par_hole_check=par_hole.$hole;

$putt_check=putt.$hole;

$gross_check=gross_score.$hole;

$gir_check=gir.$hole;

$sandsave_check=sandsave.$hole;

//check, make sure the putt is never more than the stroke

if ((${$putt_check} >= ${$gross_check}) && (${$putt_check} <> "na")) {

$error_count=1;

} else {



$error_count=0;

}//endif puttcheck



} while ($hole<18);











}//endif calculate





?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">



<? showheader("Score Manager"); ?>

<p>







<!----------------Begin Display Section--------------------------------->

<p>



<?



$coursesql="Select * from courses  

					where courseid = '$courseid' ";



				

				$coursequery=mysql_query($coursesql);

				$courserow=mysql_fetch_array($coursequery);

	 			$courseexist=mysql_numrows($coursequery);



				$courselength=$courserow["courselength"];

				$back9length=$courserow["back9length"];

				$front9length=$courserow["front9length"];



				$coursename=$courserow["coursename"];

				$sloperating=$courserow["sloperating"];

				$courserating=$courserow["courserating"];

//				$avg_driver=number_format(($out_drive_distance+$in_drive_distance)/18,2,'.','');

	//			$avg_putts=number_format(($out_putts+$in_putts)/18,2,'.','');



$coursesql="select * from courses where courseid='$courseid'";



				$coursequery=mysql_query($coursesql);

				$courserow=mysql_fetch_array($coursequery);

				$courseexist=mysql_numrows($coursequery);

				

				$coursename=$courserow['coursename'];

				$courseid=$courserow['courseid'];

				$out_par=$courserow['front9'];

				$in_par=$courserow['back9'];







				//check if this is tournament

				if ($HTTP_POST_VARS['tournament']){

				$tourneygame="YES";

				} else {

				$tourneygame="NO";
				$tournament="0";

				}

?>



<table border=1 cellpadding="5">

<tr class="menu-bg"><td>

Name</td><td>Date</td><td>Handicap</td><td>Game ID</td><td>Course</td><td>Slope</td><td>Rating</td><td>Tournament</td>

</tr>

<tr>

<td><? echo $username;?></td><td><? echo "$day/$month/$year";?></td><td><? echo $handicap;?></td>

<td><? echo $gameid;?></td><td><? echo $coursename;?></td><td><? echo $sloperating; ?></td><td><? echo $courserating; ?></td>

<td><? echo $tourneygame; ?></td>

</tr>

</table>



<?

//to display any error messages

if ($error_count == 1) {



echo "<p class='error'>Your putts must be less than your stroke!</p>";



}

?>

<p>





<?
echo "<form method=\"post\" action=\"$PHP_SELF\" onSubmit=\"return checkrequired(this)\">";

//check checkfairway
if ($checkfairway){

$checkfairwaycheck="CHECKED";

} else {

$checkfairwaycheck="";

}

//check checkbunker
if ($checkbunker){

$checkbunkercheck="CHECKED";

} else {

$checkbunkercheck="";

}


?>



<table border=1>

<tr class="menu-bg">

<td>Hole</td><td><? echo $measure; ?></td><td>Par</td><td>Index</td><td>Gr.Score</td><td>Gr.Name</td><td>Net.Score</td>

<td>Net.Name</td><td>Stableford</td><td>
<input type="checkbox" name="checkfairway" value="1" <?echo $checkfairwaycheck; ?>>Fairway</td><td>GIR</td><td>Putt</td><td><input type="checkbox" name="checkbunker" value="1" <?echo $checkbunkercheck; ?>>Bunker</td><td>Sand Save</td><td>Drive</td><td>Club</td>

</tr>

<?

//this is the MAIN IF statement for display!!

if ($courseexist) {



if ((!$calculate) || ($confirm) || ($error_count==1)) { 

$confirm_disable="DISABLED";

}else {

$confirm_disable="";

}



//the loop that outputs SQL query into nice tably forms	 

$hole=0;

//$out_par=0;

//$in_par=0;

$out_nine=0;

$in_nine=0;

$out_net=0;

$in_net=0;

$out_stableford=0;

$in_stableford=0;

$out_putts=0;

$in_putts=0;




$out_fairway=0;

$in_fairway=0;

$out_gir=0;

$in_gir=0;

$out_bunker=0;

$in_bunker=0;

$out_sandsave=0;

$in_sandsave=0;

$out_drive=0;

$in_drive=0;

$out_drive_distance=0;

$in_drive_distance=0;

$error_count=0;

do {





$hole=$hole+1;

$par_hole_check=par_hole.$hole;

$putt_check=putt.$hole;

$gross_check=gross_score.$hole;

$gir_check=gir.$hole;

$sandsave_check=sandsave.$hole;

$bunker_check=bunker.$hole;

//count the gir!

//now count the GIR!


//ok, the hole par is a GIR if grossscore-putts=parhole-2

if ((${$gross_check} - ${$putt_check}) <= (${$par_hole_check}-2)) {

$gir=1;

} else {

$gir=0;

}



//this creates variables according to the field names in the table. Lazy way to populate vars.

extract($courserow);





$par_hole=parhole.$hole;



$lengthhole=lengthhole.$hole;

$index_hole=indexhole.$hole;

$gross_score=gross_score.$hole;

$gross_score=gross_score.$hole;


$bunker=bunker.$hole;
$fairway=fairway.$hole;

//$gir=gir.$hole;



$putt=putt.$hole;

$drive=drive.$hole;

$tee_club=teeclub.$hole;


if (${$fairway} == 1) {

$fw_checkbox="CHECKED";

} else {

$fw_checkbox="";

}

if (${$bunker} == 1) {

$bunker_checkbox="CHECKED";

} else {

$bunker_checkbox="";

}




if ($gir == 1) {

$gir_checkbox="CHECKED";

} else {

$gir_checkbox="";

}



$error_count=0;

if ($calculate) {





//check, make sure the putt is never more than the stroke



//OK, begin calculation!!!



$parhole_current=${$par_hole};



//1.get the gross name

$gross_name=get_name($parhole_current,${$gross_score});



//1.2 -- Edit here if you want to add sand save as PAR &&($$gross_score<=$parhole_current)
//count sand save. if putts=1 and checkbunkercheck=1 and bunkerhole=1 and score is par or less
if ( $checkbunker && (${$bunker_check}==1) && (${$putt_check}==1) && ($$gross_score<=$parhole_current)) {


$sandsave=1;

} else {

$sandsave=0;

}



if ($sandsave==1) {

$sandsave_checkbox="CHECKED";

} else {

$sandsave_checkbox="";

}


//2.get the netscore according to the handicap

$net_score=count_net($handicap,${$gross_score},${$index_hole});

//3.get the NET name

$net_name=get_name($parhole_current,$net_score);



//4.Count stableford points

$net_name2=str_replace(" ", "_", $net_name);



$pointssql="Select * from stableford  

					where score = '$net_name2' ";



				

				$pointsquery=mysql_query($pointssql);

				$pointsrow=mysql_fetch_array($pointsquery);

	 			$pointsexist=mysql_numrows($pointsquery);



				$stableford=$pointsrow["points"];



				

//5. if drive and putt empty, then mark n/a



if (!${$drive}) {

${$drive}="na";

}				

if (!${$putt}) {



if (${$putt} == "0") {

$chip_ins=$chip_ins+1;

} else {

${$putt}="na";

}				

if (!$checkfairway) {

${$fairway}="na";
}

if (!$checkbunker) {

${$bunker}="na";
}


}

//count the out or in par and index



if ($hole<=9) {

//$out_par=$out_par+$parhole_current;

$out_nine=$out_nine+${$gross_score};

$out_net=$out_net+$net_score;

$out_stableford=$out_stableford+$stableford;

$out_putts=$out_putts+${$putt};

$out_drive_distance=$out_drive_distance+${$drive};

$out_strokes=$out_nine-$out_par;

$net_out_strokes=$out_net-$out_par;



		if ($out_strokes > 0) {

		$out_strokes="+$out_strokes";

		

		}

		if ($net_out_strokes > 0) {

		$net_out_strokes="+$net_out_strokes";

		

		}


		if ($checkfairway) {

		if (${$fairway} == 1)  {

		$out_fairway=$out_fairway+1;

		} else {
		${$fairway} = "0";
		}//endif fairway==1
		
		} else {
		${$fairway}="na";
	
		$out_fairway="na";
		}


		if ($checkbunker) {

		if (${$bunker} == 1)  {

		$out_bunker=$out_bunker+1;

		} else {
		${$bunker} = "0";
		}//endif bunker==1
		
		} else {
		${$bunker}="na";
	
		$out_bunker="na";
		}

		

		if ($gir == 1) {

		$out_gir=$out_gir+1;

		}

				if ($sandsave == 1) {

		$out_sandsave=$out_sandsave+1;

		}


		if ((${$drive} > $out_drive) && (${$drive}<>"na")) {

		$out_drive=${$drive};		

		}

} else {



//$in_par=$in_par+$parhole_current;

$in_nine=$in_nine+${$gross_score};

$in_net=$in_net+$net_score;

$in_stableford=$in_stableford+$stableford;

$in_putts=$in_putts+${$putt};

$in_drive_distance=$in_drive_distance+${$drive};

$in_strokes=$in_nine-$in_par;

$net_in_strokes=$in_net-$in_par;

		if ($in_strokes > 0) {

		$in_strokes="+$in_strokes";



		}



			if ($net_in_strokes > 0) {

		$net_in_strokes="+$net_in_strokes";

		

		}

		
		if ($checkfairway) {


		if (${$fairway} == 1) {

		$in_fairway=$in_fairway+1;
		
	  } else {
		${$fairway} = "0";
		}//endif fairway==1
		
		} else {
		${$fairway}="na";
		$in_fairway="na";
		
		}

		if ($checkbunker) {


		if (${$bunker} == 1) {

		$in_bunker=$in_bunker+1;
		
	  } else {
		${$bunker} = "0";
		}//endif bunker==1
		
		} else {
		${$bunker}="na";
		$in_bunker="na";
		
		}		
		
		
		
		
		if ($gir == 1) {

		$in_gir=$in_gir+1;

		}

			if ($sandsave == 1) {

		$in_sandsave=$in_sandsave+1;

		}
	

		if ((${$drive} > $in_drive) && (${$drive} <> "na")){

		$in_drive=${$drive};		

		}



}

				

//count total!

$total_par_hole=$out_par+$in_par;

$total_eighteen=$out_nine+$in_nine;

$total_net_hole=$out_net+$in_net;

$total_stableford=$out_stableford+$in_stableford;

$total_putts=$out_putts+$in_putts;

$total_fairway=$out_fairway+$in_fairway;

$total_gir_hole=$out_gir+$in_gir;

$total_bunker=$out_bunker+$in_bunker;

$total_sandsave_hole=$out_sandsave+$in_sandsave;

$total_strokes=$out_strokes+$in_strokes;

$total_net_strokes=$net_out_strokes+$net_in_strokes;



			if ($total_strokes > 0) {

		$total_strokes="+$total_strokes";

		

		}



			if ($total_net_strokes > 0) {

		$total_net_strokes="+$total_net_strokes";

		

		}

		

if ($in_drive > $out_drive) {

$total_drive=$in_drive;

} else {



$total_drive=$out_drive;

}



//alrite, now lets chuck into the dbase!





} //endif calculate



if ($confirm) {

$table="hole$hole";



//first delete anything with the existing gameid and userid



$scoredelsql= "Delete From $table where (gameid='$gameid' and userid='$login_id')";

	$scoredelresult=mysql_query($scoredelsql);

	

//now add	
 $scoreaddsql = "Insert into $table

	 						(gameid, courseid, par, userid, gross, gross_name, net, net_name, stableford_pts, fairway_hit, gir, putt, bunker, sand_save, drive_distance, teeclub) VALUES 

	 						('$gameid','$courseid','${$par_hole}','$login_id','${$gross_score}', '$gross_name', '$net_score', '$net_name', '$stableford', '${$fairway}', '$gir', '${$putt}', '${$bunker}', '$sandsave', '${$drive}', '${$tee_club}')";

			$scoreaddresult=mysql_query($scoreaddsql);



}//endif confirm			

echo "<p>";





?>





<?


echo "<tr><td>$hole</td><td>${$lengthhole}</td><td>${$par_hole}</td><td>${$index_hole}</td>";

echo "<td><input type=\"text\" maxlength=\"2\" size=\"2\" name=\"gross_score$hole\" value=\"${$gross_score}\"></td>";

echo "<td><input type=\"text\" maxlength=\"12\" size=\"15\" name=\"gross_name\" value=\"$gross_name\" disabled></td>";

echo "<td><input type=\"text\" maxlength=\"2\" size=\"2\" name=\"net_score\" value=\"$net_score\" disabled></td>";

echo "<td><input type=\"text\" maxlength=\"12\" size=\"15\" name=\"net_name\" value=\"$net_name\" disabled></td>";

echo "<td><input type=\"text\" maxlength=\"3\" size=\"3\" name=\"stableford\" value=\"$stableford\" disabled></td>";

echo "<td><input type=\"checkbox\" name=\"fairway$hole\" value=\"1\" $fw_checkbox></td>";

echo "<td><input type=\"checkbox\" name=\"gir$hole\" value=\"1\" $gir_checkbox disabled></td>";

echo "<td><input type=\"text\" maxlength=\"2\" size=\"2\" name=\"putt$hole\" value=\"${$putt}\"></td>";

echo "<td><input type=\"checkbox\" name=\"bunker$hole\" value=\"1\" $bunker_checkbox></td>";

echo "<td><input type=\"checkbox\" name=\"sandsave$hole\" value=\"1\" $sandsave_checkbox disabled></td>";

echo "<td><input type=\"text\" maxlength=\"3\" size=\"3\" name=\"drive$hole\" value=\"${$drive}\"></td>";







echo "<td><select name='teeclub$hole'>";



//club selection

$clubsql="Select * from clubs  

					order by teeoff ASC ";

$clubquery=mysql_query($clubsql);

$clubrow=mysql_fetch_array($clubquery);	





do {





$teeclub1_temp = $clubrow["clubid"];



if ($teeclub1_temp==${$tee_club}) { $selected = "SELECTED";

} else {

$selected = "";

}





//OK, populate the drop down on the row.

printf("<option value=\"%s\" $selected > %s",

$clubrow["clubid"], $clubrow["clubs"]);



 																																																			 

} while ($clubrow=mysql_fetch_array($clubquery));









?>

</select>





</td>

<?

echo "<input type=\"Hidden\" name=\"courseid\" value=\"$courseid\">";

echo "<input type=\"Hidden\" name=\"gameid\" value=\"$gameid\">";

echo "<input type=\"Hidden\" name=\"gamedate\" value=\"$gamedate\">";

echo "<input type=\"Hidden\" name=\"handicap\" value=\"$handicap\">";

echo "<input type=\"Hidden\" name=\"username\" value=\"$username\">";

echo "<input type=\"Hidden\" name=\"day\" value=\"$day\">";

echo "<input type=\"Hidden\" name=\"month\" value=\"$month\">";

echo "<input type=\"Hidden\" name=\"year\" value=\"$year\">";

echo "<input type=\"Hidden\" name=\"par_hole$hole\" value=\"${$par_hole}\">";





echo "</tr>";	 



if ($hole==9) {

echo "<tr class='menu-bg'><td>OUT</td><td>$front9length</td><td>$out_par</td><td>INDEX</td>";

echo "<td>$out_nine</td>";

echo "<td>";

echo "$out_strokes</td>";

echo "<td>$out_net</td>";

echo "<td>$net_out_strokes</td>";

echo "<td>$out_stableford</td>";

echo "<td>$out_fairway</td>";

echo "<td>$out_gir</td>";

echo "<td>$out_putts</td>";

echo "<td>$out_bunker</td>";

echo "<td>$out_sandsave</td>";

echo "<td>$out_drive *</td>";

echo "<td>&nbsp;</td>";



echo "</tr>";



} //endif hole9







}while ($hole<18); //end while. Elegant code!



echo "<tr class='menu-bg'><td>IN</td><td>$back9length</td><td>$in_par</td><td>INDEX</td>";

echo "<td>$in_nine</td>";

echo "<td>$in_strokes</td>";

echo "<td>$in_net</td>";

echo "<td>$net_in_strokes</td>";

echo "<td>$in_stableford</td>";

echo "<td>$in_fairway</td>";

echo "<td>$in_gir</td>";

echo "<td>$in_putts</td>";

echo "<td>$in_bunker</td>";

echo "<td>$in_sandsave</td>";

echo "<td>$in_drive *</td>";

echo "<td>&nbsp;</td>";



echo "</tr>";



echo "<tr class='menu-bg'><td>OUT</td><td>$front9length</td><td>$out_par</td><td>INDEX</td>";

echo "<td>$out_nine</td>";

echo "<td>$out_strokes</td>";

echo "<td>$out_net</td>";

echo "<td>$net_out_strokes</td>";

echo "<td>$out_stableford</td>";

echo "<td>$out_fairway</td>";

echo "<td>$out_gir</td>";

echo "<td>$out_putts</td>";

echo "<td>$out_bunker</td>";

echo "<td>$out_sandsave</td>";

echo "<td>$out_drive *</td>";

echo "<td>&nbsp;</td>";

		 

echo "</tr>";



//some cleanup to make sure putts and drive are na, and also fairway hit if it is 0

if (!$total_drive) {

$total_drive="na";

}				



if (!$total_putts) {



$total_putts="na";

}

if (!$checkfairway) {



$total_fairway="na";

}

if (!$checkbunker) {



$total_bunker="na";

}




echo "<tr class='menu-bg'><td>TOTAL</td><td>$courselength</td><td>$total_par_hole</td><td>INDEX</td>";

echo "<td>$total_eighteen</td>";

echo "<td>$total_strokes</td>";

echo "<td>$total_net_hole</td>";

echo "<td>$total_net_strokes</td>";

echo "<td>$total_stableford</td>";

echo "<td>$total_fairway</td>";

echo "<td>$total_gir_hole</td>";

echo "<td>$total_putts</td>";

echo "<td>$total_bunker</td>";

echo "<td>$total_sandsave_hole</td>";

echo "<td>$total_drive *</td>";

echo "<td>&nbsp;</td>";



echo "</tr>";













echo "</table><p>";



echo "<input type=\"Hidden\" name=\"out_drive\" value=\"$out_drive\">";

echo "<input type=\"Hidden\" name=\"in_drive\" value=\"$in_drive\">";

echo "<input type=\"Hidden\" name=\"out_drive_distance\" value=\"$out_drive_distance\">";

echo "<input type=\"Hidden\" name=\"in_drive_distance\" value=\"$in_drive_distance\">";

echo "<input type=\"Hidden\" name=\"out_putts\" value=\"$out_putts\">";

echo "<input type=\"Hidden\" name=\"in_putts\" value=\"$in_putts\">";

echo "<input type=\"Hidden\" name=\"error_count\" value=\"$error_count\">";

echo "<input type=\"Hidden\" name=\"total_gross1\" value=\"$total_eighteen\">";

echo "<input type=\"Hidden\" name=\"total_net1\" value=\"$total_net_hole\">";

echo "<input type=\"Hidden\" name=\"total_stableford1\" value=\"$total_stableford\">";

echo "<input type=\"Hidden\" name=\"total_fairway1\" value=\"$total_fairway\">";

echo "<input type=\"Hidden\" name=\"total_gir1\" value=\"$total_gir_hole\">";

echo "<input type=\"Hidden\" name=\"total_putts1\" value=\"$total_putts\">";

echo "<input type=\"Hidden\" name=\"total_bunker1\" value=\"$total_bunker\">";

echo "<input type=\"Hidden\" name=\"total_sandsave1\" value=\"$total_sandsave_hole\">";

echo "<input type=\"Hidden\" name=\"longest_drive1\" value=\"$total_drive\">";



echo "<input type=\"Hidden\" name=\"tournament\" value=\"$tournament\">";

echo "<input type=\"Hidden\" name=\"calculate\" value=\"$calculate\">";

echo "<input type=\"Submit\" name=\"calculate\" value=\"Calculate Score\">";

echo "&nbsp;<input type=\"Submit\" name=\"confirm\" value=\"Confirm Score\" $confirm_disable>";

echo "</form>";









if ($confirm) {



//first delete anything with the existing gameid and userid



$gamedelsql= "Delete From games where (gameid='$gameid' and userid='$login_id')";

	$gamedelresult=mysql_query($gamedelsql);

	

//now add	



 $gameaddsql = "Insert into games

	 						(gameid, userid, date, courseid, handicap,gross_score,net_score,stableford,fairway_hit,gir,total_putts,bunker,sandsave,longest_drive,chipins,tournament) VALUES 

	 						('$gameid','$login_id','$gamedate', '$courseid', '$handicap','$total_gross1',

							'$total_net1','$total_stableford1','$total_fairway1','$total_gir1','$total_putts1','$total_bunker1', '$total_sandsave1','$longest_drive1','$chip_ins','$tournament')";

			$gameaddresult=mysql_query($gameaddsql);







//9.putts per round

				$stat5sql="Select * from games 

					where userid = '$login_id'

					 ORDER BY longest_drive ASC";

				$stat5query=mysql_query($stat5sql);

				$stat5row=mysql_fetch_array($stat5query);

				$stat5exist=mysql_numrows($stat5query);

				$longest_drive1=0;

				$total_putts1=0;

				

				do {

				extract($stat5row);

				

				if ($total_putts <> "na") {				

				$total_putt_rounds=$total_putt_rounds+1;

				$total_putts1=$total_putts1+$total_putts;

				} //endif



				

				//34.longest drive

				if (($longest_drive <> "na") && ($longest_drive > $longest_drive1)) {				

				$longest_drive1=$longest_drive;

				} //endif

				

				

				} while ($stat5row=mysql_fetch_array($stat5query));

				

//Scrambling stats: Missed GIR

$total_drive=0;

$total_drive_distance=0;

$total_eagles=0;

$total_double_eagles=0;

$total_holeinone=0;

$total_birdies=0;

$total_par=0;



$hole=0;



include("mainstats.inc.php");			



include("substats.inc.php");			



//first get the current total money and total points

 $moneypointssql="Select total_money,total_points from ranking where userid='$login_id'";
 $moneypointsquery=mysql_query($moneypointssql);
 $moneypointsrow=mysql_fetch_array($moneypointsquery);

 $total_mny=$moneypointsrow["total_money"];
 $total_pts=$moneypointsrow["total_points"];

//echo "total cash:".$total_mny;		

//first deletes from ranking old ranks



 $statsdelsql="DELETE FROM ranking where userid='$login_id'";

 		$statsdelresult=mysql_query($statsdelsql);

	

 $statsaddsql = "INSERT INTO ranking (userid, ddistance, daccuracy, dlongest, girpct, puttavg, puttround, sandsavepct,

 totaleagles, totaldoubleeagles, totalholeinone, birdieavg, paravg, avgscore, parbreakers, par3birdies, par4birdies, par5birdies, par3pars, 

 par4pars, par5pars, par3perf, par4perf, par5perf, scrambling, net_totaleagles, net_totaldoubleeagles, net_totalholeinone, net_birdieavg, net_paravg, 

 net_avgscore, net_parbreakers, net_par3birdies, net_par4birdies, net_par5birdies, net_par3pars, net_par4pars, 

 net_par5pars, net_par3perf, net_par4perf, net_par5perf, net_scrambling, total_money, total_points)

  VALUES 

 ('$login_id', '$driving_distance', '$pct_fairways_hit', '$longest_drive1', '$pct_gir', '$avg_putt', '$putts_per_round',  '$pct_sandsaves',

 '$total_eagles', '$total_double_eagles', '$total_holeinone', '$avg_birdie', '$avg_par', '$avg_gross', '$pct_parbreak', '$par3_birdie_pct', '$par4_birdie_pct', 

 '$par5_birdie_pct', '$par3_par_pct', '$par4_par_pct', '$par5_par_pct', '$par3_avg_score', '$par4_avg_score', 

 '$par5_avg_score', '$scrambling_pct',

 '$net_total_eagles', '$net_total_double_eagles', '$net_total_holeinone', '$net_avg_birdie', '$net_avg_par', '$avg_net', '$net_pct_parbreak', '$net_par3_birdie_pct', 

 '$net_par4_birdie_pct', '$net_par5_birdie_pct', '$net_par3_par_pct', '$net_par4_par_pct', '$net_par5_par_pct', 

 '$net_par3_avg_score', '$net_par4_avg_score', 

 '$net_par5_avg_score', '$net_scrambling_pct', '$total_mny', '$total_pts')";



			$statsaddresult=mysql_query($statsaddsql);

			//echo $statsaddsql;





//delete from substats

 $substatsdelsql="DELETE FROM substats where userid='$login_id'";

 		$substatsdelresult=mysql_query($substatsdelsql);



//do the substats

$substatsaddsql="INSERT INTO substats (userid, total_drive_distance, total_drive, total_fairways_hit, poss_fairways, 

total_gir, total_bunker, total_sandsave, total_holes, total_putts2, total_holes_putt, total_birdies, total_rounds, total_par, total_gross, 

total_parbreak, total_putts1, total_putt_rounds, net_total_birdies, net_total_par, total_net, net_total_parbreak, 

par3_birdies, par4_birdies, par5_birdies, par3_pars, par4_pars, par5_pars, total_par3, total_par4, total_par5, 

total_par3_scores, total_par4_scores, total_par5_scores, scrambled_holes, missed_gir, net_par3_birdies, 

net_par4_birdies, net_par5_birdies, net_par3_pars, net_par4_pars, net_par5_pars, net_par3_scores, net_par4_scores, 

net_par5_scores, net_scrambled_holes) 

VALUES 

('$login_id', '$total_drive_distance', '$total_drive', '$total_fairways_hit', '$poss_fairways', '$total_gir', '$total_bunker2', '$total_sandsave', 

'$total_holes', '$total_putts2', '$total_holes_putt', '$total_birdies', '$total_rounds', '$total_par', '$total_gross', 

'$total_parbreak', '$total_putts1', '$total_putt_rounds', '$net_total_birdies', '$net_total_par', '$total_net', '$net_total_parbreak', 

'$par3_birdies','$par4_birdies', '$par5_birdies', '$par3_pars', '$par4_pars', '$par5_pars', '$total_par3', '$total_par4', '$total_par5',

 '$total_par3_scores', '$total_par4_scores', '$total_par5_scores', '$scrambled_holes', '$missed_gir', '$net_par3_birdies', 

 '$net_par4_birdies', '$net_par5_birdies', '$net_par3_pars', '$net_par4_pars', '$net_par5_pars', '$net_par3_scores', '$net_par4_scores',

  '$net_par5_scores', '$net_scrambled_holes')";



		$substatsaddresult=mysql_query($substatsaddsql);



//echo $substatsaddsql;



}





	

} else {



echo "No courses found.<p>";


?>





</table>



	 

<?

} 

//endif exist




?>


<?
} else {


showheader("Score Manager");
echo "Guest cannot add scorecards. Please <a href='signup.php'>register</a> for free!";

} //endif loginid<>guestid
?>


<? showfooter(); ?>

Return current item: GolfstatsPHP