} $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); // echo "$fname $lname";
$emails[$row['Player_ID']] = $row['Email']; } } else { echo "0 results"; } return $emails; } ?> <?php session_start(); function popupMessageAndRedirectBrowser($message) { echo "<script type='text/javascript'>alert('{$message}');history.go(-1);document.location = 'joinTeam.php';</script>"; } $players = createPlayerEmailArray(); $name = nameArray(); // echo 'got id' . $_POST['teamID']; // echo '<br> emailing...' . $players[$_POST['teamID']]; include 'sendEmail.php'; // echo "<br> You have succesfully requested to join the team!"; $message = "The team leader has received your request and will get back to you soon!"; sendEmailTo($players[$_POST['teamID']], $name[$_SESSION['player_id']], $players[$_SESSION['player_id']], $_POST['teamName']); popupMessageAndRedirectBrowser($message); ?>