Last active
April 12, 2019 02:00
-
-
Save shitrus/a12a3d00827aebee4f15c189c6be7e15 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*<!--// Initialize the session | |
session_start(); | |
// Check if the user is logged in, if not then redirect him to login page | |
if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true){ | |
header("location: login.php"); | |
exit; | |
}-->*/ | |
require_once "config.php"; | |
?> | |
<!DOCTYPE html> | |
<html lang="en"> | |
<link rel="stylesheet" type="text/css" href="stylesheet.css"> | |
<body> | |
<div class="my-container"> | |
<!--Hi, <b><?php echo htmlspecialchars($_SESSION["username"]); ?></b>. Welcome to our site. | |
<a href="reset-password.php" class="btn btn-warning">Reset Your Password</a> | |
<a href="logout.php" class="btn btn-danger">Sign Out of Your Account</a> | |
--> | |
<table class="greenTable"> | |
<thead> | |
<tr> | |
<th>Entrant</th> | |
<th>Golfer One</th> | |
<th>Golfer Two</th> | |
<th>Golfer Three</th> | |
<th>Golfer Four</th> | |
<th>R1</th><th>R2</th><th>R3</th><th>R4</th><th>Day 1</th><th>R1</th><th>R2</th><th>R3</th><th>R4</th><th>R1</th><th>R2</th><th>R3</th><th>R4</th><th>R1</th><th>R2</th><th>R3</th><th>R4</th> | |
</tr> | |
</thead> | |
<tbody> | |
<?php | |
$rowtot = mysqli_query($link,"select count(*) as COUNT from scorecard"); | |
$rownum = mysqli_fetch_array($rowtot); | |
$i = 1; | |
while ($i <= $rownum['COUNT']): | |
?> | |
<tr> | |
<td style="font-weight:bold;text-align:left"><?php $query = "select entry_name as ENTRY from scorecard where entry_id='$i'";$result = mysqli_query($link,$query);$row = mysqli_fetch_array($result);echo $row['ENTRY']; ?></td> | |
<td style="text-align:left"><?php $query = "select salary.name as GOLFERONE from scorecard inner join salary on salary.golfer_id = scorecard.golfer_one where scorecard.entry_id='$i'";$result = mysqli_query($link,$query);$row = mysqli_fetch_array($result);echo $row['GOLFERONE']; ?></td> | |
<td style="text-align:left"><?php $query = "select salary.name as GOLFERTWO from scorecard inner join salary on salary.golfer_id = scorecard.golfer_two where scorecard.entry_id='$i'";$result = mysqli_query($link,$query);$row = mysqli_fetch_array($result);echo $row['GOLFERTWO']; ?></td> | |
<td style="text-align:left"><?php $query = "select salary.name as GOLFERTHREE from scorecard inner join salary on salary.golfer_id = scorecard.golfer_three where scorecard.entry_id='$i'";$result = mysqli_query($link,$query);$row = mysqli_fetch_array($result);echo $row['GOLFERTHREE']; ?></td> | |
<td style="text-align:left"><?php $query = "select salary.name as GOLFERFOUR from scorecard inner join salary on salary.golfer_id = scorecard.golfer_four where scorecard.entry_id='$i'";$result = mysqli_query($link,$query);$row = mysqli_fetch_array($result);echo $row['GOLFERFOUR']; ?></td> | |
<?php | |
$query1 = "select round_one.score as ROUNDONE from scorecard inner join round_one on round_one.golfer_id = scorecard.golfer_one where scorecard.entry_id='$i'"; | |
$result1 = mysqli_query($link,$query1); | |
$row1 = mysqli_fetch_array($result1); | |
$to_par1 = $row1['ROUNDONE']; | |
$query2 = "select round_one.score as ROUNDONE from scorecard inner join round_one on round_one.golfer_id = scorecard.golfer_two where scorecard.entry_id='$i'"; | |
$result2 = mysqli_query($link,$query2); | |
$row2 = mysqli_fetch_array($result2); | |
$to_par2 = $row2['ROUNDONE']; | |
$query3 = "select round_one.score as ROUNDONE from scorecard inner join round_one on round_one.golfer_id = scorecard.golfer_three where scorecard.entry_id='$i'"; | |
$result3 = mysqli_query($link,$query3); | |
$row3 = mysqli_fetch_array($result3); | |
$to_par3 = $row3['ROUNDONE']; | |
$query4 = "select round_one.score as ROUNDONE from scorecard inner join round_one on round_one.golfer_id = scorecard.golfer_four where scorecard.entry_id='$i'"; | |
$result4 = mysqli_query($link,$query4); | |
$row4 = mysqli_fetch_array($result4); | |
$to_par4 = $row4['ROUNDONE']; | |
$day_score_array = array($to_par1, $to_par2, $to_par3, $to_par4); | |
$day_score = array_sum($day_score_array) - array_max($day_score_array); | |
echo '<td style="text-align:left">' . $to_par1 . '</td>'; | |
echo '<td style="text-align:left">' . $to_par2 . '</td>'; | |
echo '<td style="text-align:left">' . $to_par3 . '</td>'; | |
echo '<td style="text-align:left">' . $to_par4 . '</td>'; | |
echo '<td style="text-align:left">' . $day_score . '</td>'; | |
?> | |
<td style="text-align:center"><?php $query = "select round_two.score as ROUNDTWO from scorecard inner join round_two on round_two.golfer_id = scorecard.golfer_one where scorecard.entry_id='$i'";$result = mysqli_query($link,$query);$row = mysqli_fetch_array($result);echo $row['ROUNDTWO']; ?></td> | |
<td style="text-align:center"><?php $query = "select round_two.score as ROUNDTWO from scorecard inner join round_two on round_two.golfer_id = scorecard.golfer_two where scorecard.entry_id='$i'";$result = mysqli_query($link,$query);$row = mysqli_fetch_array($result);echo $row['ROUNDTWO']; ?></td> | |
<td style="text-align:center"><?php $query = "select round_two.score as ROUNDTWO from scorecard inner join round_two on round_two.golfer_id = scorecard.golfer_three where scorecard.entry_id='$i'";$result = mysqli_query($link,$query);$row = mysqli_fetch_array($result);echo $row['ROUNDTWO']; ?></td> | |
<td style="text-align:center"><?php $query = "select round_two.score as ROUNDTWO from scorecard inner join round_two on round_two.golfer_id = scorecard.golfer_four where scorecard.entry_id='$i'";$result = mysqli_query($link,$query);$row = mysqli_fetch_array($result);echo $row['ROUNDTWO']; ?></td> | |
<td style="text-align:center"><?php $query = "select round_three.score as ROUNDTHREE from scorecard inner join round_three on round_three.golfer_id = scorecard.golfer_one where scorecard.entry_id='$i'";$result = mysqli_query($link,$query);$row = mysqli_fetch_array($result);echo $row['ROUNDTHREE']; ?></td> | |
<td style="text-align:center"><?php $query = "select round_three.score as ROUNDTHREE from scorecard inner join round_three on round_three.golfer_id = scorecard.golfer_two where scorecard.entry_id='$i'";$result = mysqli_query($link,$query);$row = mysqli_fetch_array($result);echo $row['ROUNDTHREE']; ?></td> | |
<td style="text-align:center"><?php $query = "select round_three.score as ROUNDTHREE from scorecard inner join round_three on round_three.golfer_id = scorecard.golfer_three where scorecard.entry_id='$i'";$result = mysqli_query($link,$query);$row = mysqli_fetch_array($result);echo $row['ROUNDTHREE']; ?></td> | |
<td style="text-align:center"><?php $query = "select round_three.score as ROUNDTHREE from scorecard inner join round_three on round_three.golfer_id = scorecard.golfer_four where scorecard.entry_id='$i'";$result = mysqli_query($link,$query);$row = mysqli_fetch_array($result);echo $row['ROUNDTHREE']; ?></td> | |
<td style="text-align:center"><?php $query = "select round_four.score as ROUNDFOUR from scorecard inner join round_four on round_four.golfer_id = scorecard.golfer_one where scorecard.entry_id='$i'";$result = mysqli_query($link,$query);$row = mysqli_fetch_array($result);echo $row['ROUNDFOUR']; ?></td> | |
<td style="text-align:center"><?php $query = "select round_four.score as ROUNDFOUR from scorecard inner join round_four on round_four.golfer_id = scorecard.golfer_two where scorecard.entry_id='$i'";$result = mysqli_query($link,$query);$row = mysqli_fetch_array($result);echo $row['ROUNDFOUR']; ?></td> | |
<td style="text-align:center"><?php $query = "select round_four.score as ROUNDFOUR from scorecard inner join round_four on round_four.golfer_id = scorecard.golfer_three where scorecard.entry_id='$i'";$result = mysqli_query($link,$query);$row = mysqli_fetch_array($result);echo $row['ROUNDFOUR']; ?></td> | |
<td style="text-align:center"><?php $query = "select round_four.score as ROUNDFOUR from scorecard inner join round_four on round_four.golfer_id = scorecard.golfer_four where scorecard.entry_id='$i'";$result = mysqli_query($link,$query);$row = mysqli_fetch_array($result);echo $row['ROUNDFOUR']; ?></td> | |
</tr> | |
<?php | |
$i++; | |
endwhile; ?> | |
</tbody> | |
</table> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment