$name) { if ( $key == $selected ) echo " \n"; else echo " \n"; }}// Displays play entry form.function displayInsertForm( $numPlayers ) { global $PHP_SELF; global $gameNames, $scenarioNames, $countryNames, $playerNames; global $selectedGameID; global $selectedScenarioID; global $date; echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; // Display game names echo "\n"; // Display scenario names echo "\n"; // Display player count. echo "\n"; // Display countries/players/banners. if ( isset( $selectedScenarioID ) ) { unset( $countryNames ); $sql = "SELECT TCountryNames.name, TScenarioCountry.maxflags FROM TCountryNames, TScenarioCountry WHERE idGameNames='$selectedGameID' AND idScenarioNames='$selectedScenarioID' AND TScenarioCountry.idCountryNames=TCountryNames.id"; $result = mysql_query( $sql ); $rowCount = 0; while ( $row = mysql_fetch_array( $result, MYSQL_NUM )) { $countryNames[ $row[ 0 ] ] = $row[ 1 ]; $rowCount++; } } if ( isset( $countryNames ) ) reset( $countryNames ); if ($numPlayers > 0 ) { echo "\n"; echo "\n"; echo "\n"; } else { echo "\n"; } echo "\n"; echo "\n"; echo "\n"; if ($numPlayers > 1 ) { echo "\n"; echo "\n"; echo "\n"; } else { echo "\n"; } echo "\n"; for ( $i = 2; $i < $numPlayers; $i++ ) { echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; } echo "
DateGameScenarioPlayersNationalityPlayerBanners
Comment
\n"; if ( is_null( $date ) ) { $date = strftime( "%Y-%m-%d", time() ); // local time as YYYY-mm-dd } echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; if ( isset( $selectedScenarioID ) ) { $sql = "SELECT playerCount FROM TScenarioNames WHERE idGameNames='$selectedGameID' AND id='$selectedScenarioID'"; $result = mysql_query( $sql ); while ( $row = mysql_fetch_array( $result, MYSQL_ASSOC )) { $numPlayers = $row[ "playerCount" ]; } echo "\n"; } else echo "\n"; echo "\n"; if ( isset( $countryNames ) ) { $countryName = key( $countryNames ); $maxFlags = current( $countryNames ); next( $countryNames ); } else { unset( $countryName ); unset( $maxFlags ); } // echo "

DEBUG: countryName=$countryName

\n"; // echo "

DEBUG: maxFlags=$maxFlags

\n"; echo "\n"; echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo " 
\n"; echo "\n"; echo "\n"; if ( isset( $countryNames ) ) { $countryName = key( $countryNames ); $maxFlags = current( $countryNames ); next( $countryNames ); } echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo " 
 \n"; if ( isset( $countryNames ) ) { $countryName = key( $countryNames ); $maxFlags = current( $countryNames ); next( $countryNames ); } echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
\n"; echo "\n"; echo "\n"; echo "
\n";}// Displays a single table row an array with keys: date, selectedGames, selectedScenarions, playerCount, nation0, player0, banners0, etc.function displayRecord( $data ) { if ( $data == null ) { echo "no data\n"; return; } echo "\n"; echo "" . $data[ 'playID' ] . "\n"; echo "" . $data[ 'date' ] . "\n"; echo "" . $data[ 'gameName' ] . "\n"; echo "" . $data[ 'scenarioName' ] . "\n"; echo "" . $data[ 'playerCount' ] . "\n"; for ( $i = 0; $i < $data[ 'playerCount' ]; $i++ ) { $key = "player" . strval( $i + 0 ); echo "" . $data[ $key ] . "\n"; $key = "nation" . strval( $i + 0 ); echo "" . $data[ $key ] . "\n"; $key = "banners" . strval( $i + 0 ); echo "" . $data[ $key ] . "\n"; } echo "\n";}?>

Dan Becker's Game Page

Insert Tournament Plays

Purpose: Use this page to insert plays in the tournament database.


Select game date, game name and scenario, players, scores, etc.
DEBUG: selectedGame key=$selectedGameID

\n";}if ( isset( $_POST[ 'selectedScenarios' ] ) ) { $selectedScenarioID = $_POST[ 'selectedScenarios' ] + 0; // convert to integer. // echo "

DEBUG: selectedScenario key=$selectedScenarioID

\n";}if ( isset( $_POST[ 'date' ] ) ) { $date = $_POST[ 'date' ]; // echo "

DEBUG: selectedScenario key=$selectedScenarioID

\n";}if ( isset( $command ) ) { // echo "DEBUG: Command is set to \"$command\".
\n"; if (0 == strcmp( $command, "insertPlay" )) { // echo "DEBUG: insertPlay.
\n"; $playID = insertRecord( $_POST ); if ( $playID > 0 ) { $data = getRecord( $playID ); echo "

Entered the following record:
\n"; echo "\n"; echo "\n"; displayRecord( $data ); echo "
idDateGameScenario#PlayerNationPtsPlayerNationPts
\n"; } } unset( $command );} // issetecho "

Enter records here:\n";displayInsertForm( 2 );?>

User menu |Admin menu