$tourneyName
"; echo "$tourneyDate
"; echo "$tourneyUID
"; echo "$division
"; echo "$numPlayers
"; echo "$bestOf
"; echo "$winningTeamName
"; echo "$winningPlayer1
"; echo "$winningPlayer2
"; echo "$winningPlayer3
"; echo "$winningPlayer4
"; echo "$notes
"; $insert = $conn->prepare("INSERT INTO " . $tournamentDataTableName . " ( tournamentUID, tournamentName, tournamentDate, tournamentDivision, numPlayers, bestOf, winningTeamName, winner1, winner2, winner3, winner4, notes ) VALUES ( :tournamentUID, :tournamentName, :tournamentDate, :tournamentDivision, :numPlayers, :bestOf, :winningTeamName, :winner1, :winner2, :winner3, :winner4, :notes )"); $insert->bindValue(":tournamentUID", $tourneyUID); $insert->bindValue(":tournamentName", $tourneyName); $insert->bindValue(":tournamentDate", $tourneyDate); $insert->bindValue(":tournamentDivision", $division); $insert->bindValue(":numPlayers", $numPlayers); $insert->bindValue(":bestOf", $bestOf); $insert->bindValue(":winningTeamName", $winningTeamName); $insert->bindValue(":winner1", $winningPlayer1); $insert->bindValue(":winner2", $winningPlayer2); $insert->bindValue(":winner3", $winningPlayer3); $insert->bindValue(":winner4", $winningPlayer4); $insert->bindValue(":notes", $notes); $insert->execute(); echo "Successfully uploaded new tournament record"; // Function from StackOverflow used to get the base URL, to which we append // the redirect (where the user came from) function url(){ return sprintf( "%s://%s/tournament", isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http', $_SERVER['SERVER_NAME'] ); } $address = url(); echo "Redirecting to $address/$tourneyUID...
"; echo ""; } catch (PDOException $e) { // failed connection echo "Connection failed: " . $e->getMessage(); } $conn = null; ?>