function printResult($result) { if ($result->num_rows > 0) { echo "<table class='report alternate'>"; echo "<tr class='table_header'><th>Place</th><th>Team Name</th><th>Leader Name</th><th>Games Played</th><th>Win Count</th><th>Win Percentage</th></tr>"; $place = 1; $teams = createPlayersArray(); while ($row = $result->fetch_assoc()) { echo "<tr>"; echo "<td>{$place}</td>"; echo "<td>" . $row['Name'] . "</td>"; echo "<td>" . $teams[$row['Leader']] . "</td>"; echo "<td>" . $row['Game_Count'] . "</td>"; echo "<td>" . $row['Win_Count'] . "</td>"; $percentage = 100 * $row['Win_Count'] / $row['Game_Count']; echo "<td>" . number_format($percentage, 0, '.', '') . " %</td>"; echo "</tr>"; $place++; } echo "</table>"; } else { echo "0 results."; } }
} } $query1 = "SELECT * FROM team WHERE Player_1 = '{$playerid}' OR\nPlayer_2 = '{$playerid}' OR Player_3 = '{$playerid}' OR Player_4 =\n'{$playerid}' OR Player_5 = '{$playerid}'"; $result = $conn->query($query1); $numrows = $result->num_rows; if ($numrows != 0) { while ($row = mysqli_fetch_assoc($result)) { $teamname = $row['Name']; $leader = $row['Leader']; $teamMember1 = $row['Player_1']; $teamMember2 = $row['Player_2']; $teamMember3 = $row['Player_3']; $teamMember4 = $row['Player_4']; $teamMember5 = $row['Player_5']; $teamID = $row['Team_ID']; $teams = createPlayersArray(); $allEmails = createPlayerEmailArray(); } } //display stats $query = "SELECT * FROM players WHERE Email = '{$user}'"; $result = $conn->query($query); $numrows = $result->num_rows; if ($numrows != 0) { while ($row = mysqli_fetch_assoc($result)) { $fname = $row['First_Name']; $lname = $row['Last_Name']; } } $fname = ucfirst($fname); $lname = ucfirst($lname);