Sorry, a technical problem occurred. Scores were not added.
" . mysqli_error($conn);
}
mysqli_stmt_close($stmt);
}
// Fetch the latest scores
$sql = "SELECT * FROM `VNSB_scores` ORDER BY ID DESC LIMIT 1";
$result = mysqli_query($conn, $sql);
if (!$result) {
die("ERROR: Unable to read record from 'VNSB_scores'!
" . mysqli_error($conn));
}
$scores = mysqli_fetch_assoc($result);
$NFC_FIRST = $scores['NFC_FIRST'] ?? '';
$AFC_FIRST = $scores['AFC_FIRST'] ?? '';
$NFC_HALF = $scores['NFC_HALF'] ?? '';
$AFC_HALF = $scores['AFC_HALF'] ?? '';
$NFC_THIRD = $scores['NFC_THIRD'] ?? '';
$AFC_THIRD = $scores['AFC_THIRD'] ?? '';
$NFC_FINAL = $scores['NFC_FINAL'] ?? '';
$AFC_FINAL = $scores['AFC_FINAL'] ?? '';
$ADD_SCORES = ($NFC_FINAL === NULL || $AFC_FINAL === NULL) ? 1 : 0;
// Fetch assigned numbers
$sql = "SELECT * FROM VNSB_numbers";
$result = mysqli_query($conn, $sql);
if (!$result) {
die("ERROR: Unable to read records from 'VNSB_numbers'!
" . mysqli_error($conn));
}
$cnt = 0;
while ($record = mysqli_fetch_assoc($result)) {
$cnt++;
$NFC[$cnt] = $record['NFC'];
$AFC[$cnt] = $record['AFC'];
}
// Fetch names for each square
$sql = "SELECT * FROM VNSB_squares";
$result = mysqli_query($conn, $sql);
if (!$result) {
die("ERROR: Unable to read records from 'VNSB_squares'!
" . mysqli_error($conn));
}
while ($record = mysqli_fetch_assoc($result)) {
$NAME[$record['SQUARE']] = $record['NAME'];
$EMAIL[$record['SQUARE']] = $record['EMAIL'];
}
// Display the form for adding scores
if ($ADD_SCORES) {
?>
| The Payout: |
|
End of first quarter:
End of second quarter:
End of third quarter:
Final Score:
|
= htmlspecialchars($NFC_FIRST) ?> = htmlspecialchars($AFC_FIRST) ?>
= htmlspecialchars($NFC_HALF) ?> = htmlspecialchars($AFC_HALF) ?>
= htmlspecialchars($NFC_THIRD) ?> = htmlspecialchars($AFC_THIRD) ?>
= htmlspecialchars($NFC_FINAL) ?> = htmlspecialchars($AFC_FINAL) ?>
|
= htmlspecialchars($WIN_FIRST) ?>%
= htmlspecialchars($WIN_SECOND) ?>%
= htmlspecialchars($WIN_THIRD) ?>%
= htmlspecialchars($WIN_FINAL) ?>%
|
$= htmlspecialchars($FIRST) ?>
$= htmlspecialchars($SECOND) ?>
$= htmlspecialchars($THIRD) ?>
$= htmlspecialchars($FINAL) ?>
|
Email Winners
1st Quarter Winner ($NFC[$x],$AFC[$y]) Square #$square (" . htmlspecialchars($NAME[$square]) . ")";
mysqli_query($conn, "UPDATE VNSB_squares SET FIRST='1' WHERE SQUARE='$square' LIMIT 1");
if ($_GET['m'] === 'yes') {
email_notify($EMAIL[$square]);
}
}
if (($NFC[$x] == substr($NFC_HALF, -1)) && ($AFC[$y] == substr($AFC_HALF, -1)) && ($NFC_HALF && $AFC_HALF)) {
echo "Halftime Winner ($NFC[$x],$AFC[$y]) Square #$square (" . htmlspecialchars($NAME[$square]) . ")
";
mysqli_query($conn, "UPDATE VNSB_squares SET HALF='1' WHERE SQUARE='$square' LIMIT 1");
if ($_GET['m'] === 'yes') {
email_notify($EMAIL[$square]);
}
}
if (($NFC[$x] == substr($NFC_THIRD, -1)) && ($AFC[$y] == substr($AFC_THIRD, -1)) && ($NFC_THIRD && $AFC_THIRD)) {
echo "3rd Quarter Winner ($NFC[$x],$AFC[$y]) Square #$square (" . htmlspecialchars($NAME[$square]) . ")
";
mysqli_query($conn, "UPDATE VNSB_squares SET THIRD='1' WHERE SQUARE='$square' LIMIT 1");
if ($_GET['m'] === 'yes') {
email_notify($EMAIL[$square]);
}
}
if (($NFC[$x] == substr($NFC_FINAL, -1)) && ($AFC[$y] == substr($AFC_FINAL, -1)) && ($NFC_FINAL && $AFC_FINAL)) {
echo "Final Winner ($NFC[$x],$AFC[$y]) Square #$square (" . htmlspecialchars($NAME[$square]) . ")
";
mysqli_query($conn, "UPDATE VNSB_squares SET FINAL='1' WHERE SQUARE='$square' LIMIT 1");
if ($_GET['m'] === 'yes') {
email_notify($EMAIL[$square]);
}
}
$cnt++;
}
}
}
?>