Bettor Input and lock

[insert_php]
// Start the session
session_start();
[/insert_php]

Turn Your Phone Horizontally to Maximize Viewing Width

Data Entry – Edit for Parimutuels – Select your name on the bettor drop down
Update Your Bets – Change the NO to YES, Select a New $ amount from the drop down
Save it by clicking the Green Button “Update My Bets” – See Bottom of Table
Check your $ Total and Line items – Make a mistake? – Repeat and change again

When Finished – Proceed to the Lock My Bets Red Button at the very bottom

Select the Bettor :

[insert_php]
if(isset($_POST[‘betting’]))
{
$servername = ‘localhost’;
$username = ‘i3141100_wp6’;
$password = ‘K.v8uHDF5v9jxplL34C32’;
//$dbname = localhost;
$dbname = ‘i3141100_wp6’;

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die(“Connection failed: ” . $conn->connect_error);
}
else {
global $wpdb;
$betname = $_POST[‘betname’];
$_SESSION[‘betname’] = $betname;
$queryS= $wpdb->prepare(“SELECT sum(teamamt) as totalbets
FROM MGMPM_Bets25Master WHERE bettorname = ‘$betname'”);
$resultsS = $wpdb->get_var ($queryS);
$sumbets = $resultsS;
// foreach ($resultsS as $row)
echo “The Total Amount That You Bet Was $ “;
echo “$sumbets”;
echo ” On The Teams Listed Below “;

}
}
[/insert_php]

[insert_php]

if(isset($_POST[‘betting’]))
{

$servername = ‘localhost’;
$username = ‘i3141100_wp6’;
$password = ‘K.v8uHDF5v9jxplL34C32’;
//$dbname = localhost;
$dbname = ‘i3141100_wp6’;

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die(“Connection failed: ” . $conn->connect_error);
}
else {
global $wpdb;
$betname = $_POST[‘betname’];
// $_SESSION[‘betname’] = $betname;
// $_SESSION[‘betnameB’] = $betname;
$queryA = $wpdb->prepare ( “SELECT bettorname, rank, team, teamamt FROM MGMPM_Bets25Master where bettorname = ‘$betname’
order by rank,teamamt”);
$resultsA = $wpdb->get_results ($queryA,ARRAY_A);
// echo var_dump($resultsA);
$queryB = $wpdb->prepare (“SELECT increment FROM MGPM_increments order by increment”);
$resultsB = $wpdb->get_results ($queryB,ARRAY_A);

$i = 0;
foreach ($resultsA as $row)
{

echo “

“;
echo “

“;

echo “

“;

echo “

“;
//here for check box
echo “

“;

echo “

“;
echo “

“;
$i++;
}
}
//this last bracket closes the first IF
}
//var_dump (‘recmatch[]’);
[/insert_php]

Bettor’s Name Team Being Bet On Current Bet Change Your Bet? Your New Bet
“;
echo “$row[bettorname]”;
echo “
“;
echo “$row[team]”;
echo “
“;
echo “$row[teamamt]”;
echo “
“;
echo ‘ ‘;
// this following part is not needed as puts a checkbox in the column
// echo ‘‘;
echo “
“;
echo ‘‘;

echo ““;

echo “



[insert_php]
if(isset($_POST[‘posting’]))

//the following is needed any time you post to the wpdb sql databases
global $wpdb;

{
$prefer = $_POST[‘prefer’];
$recmatch = $_POST[‘recmatch’];
$subcheck = $_POST[‘check’];

$combinedAsArray = array();
//the above just declares an array variable

foreach ($prefer as $key => $value){

if (array_key_exists($key, $recmatch)){
$combinedAsArray[$key] = array($value, $recmatch[$key], $subcheck[$key]);
}
else{
$combinedAsArray[$key] = array($value, [$key], $subcheck[$key]);

}
}

$keys = array_keys($combinedAsArray);

for($n=0; $n < count($keys); ++$n) { $newpref = $combinedAsArray[$n][0]; $dateref = $combinedAsArray[$n][1]; $checkref = $combinedAsArray[$n][2]; $newpref2 = intval($newpref); $bettor = ($_SESSION['betname']); //var_dump ($checkref); $queryC = $wpdb->prepare ( “Update MGMPM_Bets25Master
set teamamt = $newpref2
where bettorname = ‘$bettor’ and team = ‘$dateref’
and ‘$checkref’ = ‘yes’ and locking = ‘NO'”);
$resultsC = $wpdb->get_results ( $queryC);
}

//$bettor = ($_SESSION[‘betname’]);
// $_SESSION[‘betname2’] = ‘Frankie’;
}
echo “
“;
[/insert_php]

Click the Green update button to check your input and / or modify
Ready to LOCK Your Bets to the Current Bets Column and Total Above ?
ONCE LOCKED YOU CANNOT MAKE ANY MORE CHANGES
Select Name below – Click Red Button – Take a cell phone snap shot and cash to the Registration Desk

Select the Bettor :

[insert_php]

if(isset($_POST[‘lockerup’]))
{
$servername = ‘localhost’;
$username = ‘i3141100_wp6’;
$password = ‘K.v8uHDF5v9jxplL34C32’;
//$dbname = localhost;
$dbname = ‘i3141100_wp6’;

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die(“Connection failed: ” . $conn->connect_error);
}
else {
global $wpdb;
$nailit = $_POST[‘nailit’];
if ($nailit <>‘No Bettor’)

{
$queryP= $wpdb->prepare (“SELECT locking
FROM MGMPM_Bets25Master WHERE bettorname = ‘$nailit’ and rank=2”);
$resultsP = $wpdb->get_var ($queryP);

if ($resultsP == ‘YES’)
{
//this echo script is funky must be continuous string of lines
echo ‘‘;

}
//then $ resultsP must equal NO
else {
$queryU = $wpdb->prepare (“Update MGMPM_Bets25Master
set locking = ‘YES’ where bettorname = ‘$nailit'”);
$resultsU = $wpdb->get_results ($queryU);
//update teamcount
$queryCT = $wpdb->prepare (“Update MGMPM_Bets25Master
set teamcount = (teamamt/10) where bettorname = ‘$nailit’ and teamamt<>0″);
$resultsCT = $wpdb->get_results ($queryCT);

}
}
//close first else
}
//close first if
}

[/insert_php]