Dan Becker's Game Page

Insert Play Record

Purpose: Use this page to insert play records in the database.


Enter records:
Form:yyyy/mm/dd;GameName[/player count][;Player[+teammate][/points]]*
Examples: 2002/07/28;Vampire;Andrew;Ed;Dan
2002/07/29;Space Walk;Susan;(Andrew;Ed);MarkH;Dan
2002/07/30;Metro/6;Andrew/3;Ed/-3;Dan/-5
2002/07/30;Tichu/2;Dan+Jon;MarkH+Fred
Date delimiters are -;/, fields delimiters are ;/.Player count is optional, although must be included if partial scores are given.Points are optional, you may specify players in finish order.Ties may be delimited by parentheses.Teammates may be delimited with plus signs

Enter records here:

";if ( strlen( $defaultText ) > 0 ) { echo $defaultText;}echo "
\n";?>
\n"; $commandDelim = "=,"; $command = strtok( $update, $commandDelim ); if (0 == strcmp( $command, "insertGame" )) { $newName = strtok( $commandDelim ); if (( false != $newName ) && ( strlen( $newName ) > 0 )) { $sql = "INSERT INTO $gameNamesTable ( name ) VALUES ( \"$newName\" )"; $sqlResults = sqlQuery( $sql, true ); } else { echo "Error: Garbled game name for command=$command, name=\"$newName\".
\n"; } } else if (0 == strcmp( $command, "insertPlayer" )) { $newName = strtok( $commandDelim ); if (( false != $newName ) && ( strlen( $newName ) > 0 )) { $sql = "INSERT INTO $playerNamesTable ( name ) VALUES ( \"$newName\" )"; $sqlResults = sqlQuery( $sql, false ); } else { echo "Error: Garbled player name for command=$command, name=\"$newName\".
\n"; } } else { echo "Error: Unknown command \"$command\".
\n"; }} // issetif ( isset( $insertRecords ) ) { // echo "DEBUG: insertRecords=$insertRecords.
\n"; if ( strlen( $insertRecords ) > 0 ) { // Process records. $records = explode( "\r\n", $insertRecords ); // echo "

DEBUG: Got text that explodes into " . sizeof( $records ) . " records.
\n"; $insertRecords = ""; for ( $i = 0; $i < count( $records ); $i++ ) { $record = $records[ $i ]; if ( 0 < strlen( $record ) ) { // First validate that this is a valid record. // validation on, warnings on echo "Processing record: \"$record\"
\n"; // DEBUG // record, sqlExecute, warnings, errors if ( false == insertRecord( $record, false ) ) { // Not inserted. Reattach for another go at it. echo "Record not inserted.

\n"; if ( strlen( $insertRecords ) > 0 ) $insertRecords .= "\n"; $insertRecords .= $record; } else { // validation off, warnings off // echo "DEBUG: Record validated.
\n"; // DEBUG insertRecord( $record, true, false ); // record, sqlExecute, warnings, errors } // if } // if strlen } // for each record // State number of plays // echo "There are " . countRows( "Plays" ) . " record(s) in the Plays table.
\n"; } // strlen > 0} // if issetdisplayInsertForm( $insertRecords );?>

User menu |Admin menu