Q: Passing JS variables to a PHP file (using ajax) in order to update SQL table This ajax code gets called in Javascript, and reads:
function ajaxUpdate(){
            $.ajax({
            type: "POST",
            url: "results.php",
            data:{ winsSame: winsSame, 
                gamesSame: gamesSame, 
                winsChange: winsChange, 
                gamesChange: gamesChange },
            success: function(data){
                console.log(data);
            } 
        })
        }

I presume this works because the console reads:
Array
(
    [winsSame] => 0
    [gamesSame] => 3
    [winsChange] => 2
    [gamesChange] => 2
)

My results.php page gives me nothing but "Undefined array key "winsSame"" for my variables:
print_r($_POST);

  - or -

$updateWinsSame = $_POST['winsSame'];
$updateGamesSame = $_POST['gamesSame'];
$updateWinsChange = $_POST['winsChange'];
$updateGamesChange = $_POST['gamesChange'];

Then I try to place them in this PHP code to update a SQL database, where shockingly it sort-of works.  Although all of the $old___ variables stay '0':
$oldWinsSame = 0;
$oldGamesSame = 0;
$oldWinsChange = 0;
$oldGamesChange = 0;

if ($updateWinsSame > $oldWinsSame){
    mysqli_query($conn, "UPDATE scores SET AllWinsSame = AllWinsSame+1, AllGamesSame = AllGamesSame+1;");
    $oldWinsSame += 1;
    $oldGamesSame += 1;

} else if($updateWinsChange > $oldWinsChange){
    mysqli_query($conn, "UPDATE scores SET AllWinsChange = AllWinsChange+1, AllGamesChange = AllGamesChange+1;");
    $oldWinsChange += 1;
    $oldGamesChange += 1;

} else if($updateGamesSame > $oldGamesSame){
    mysqli_query($conn, "UPDATE scores SET AllGamesSame = AllGamesSame+1;");
    $oldGamesSame += 1;

} else if($updateGamesChange > $oldGamesChange){
    mysqli_query($conn, "UPDATE scores SET AllGamesChange = AllGamesChange+1;");
    $oldGamesChange += 1;

}else{
    die("bummer");
}

Thanks
