I am trying to make a ajax call to do a database update in my php class. However, it seems the class is being called but the parameters are not passed for some reason. Here is my jquery:
$(".sendRSVP").click(function(e){
e.preventDefault();
var nameArray = [];
//var uniqueCode = parseInt($(this).find('.theCheckbox').attr('id'));
//var response = ($(this).find('.theCheckbox').is(":checked")) ? '1' : '0';
//the parameters passed should be uniqueCode and response which both gave legit values
if($("#displayContacts").is(":visible")){
$.get("submitRSVP.php", {rs: '1', resp: '12345'})
.done(function(rtn){
console.log(rtn); //error is returned
})
}
});
Here is my php code:
<?php
require 'dbh.php';
$rsvp = $REQUEST["rs"];
$response = $REQUEST["resp"];
session_start();
if(session_start()) $invitationCode = $_SESSION['login_user'];
$hint = "here1";
try{
$updateQuery = "UPDATE `db686470460`.`GuestWithPlusOnes` SET `Confirmed`= '$response' WHERE `GuestWithPlusOnes`.`UniqueID`= '$rsvp'";
$updateStmt = $conn->prepare($updateQuery);
$updateStmt->execute();
if ($updateStmt->rowCount() > 0) {
$hint = 'success';
}else {
$hint = 'error';
}
$_SESSION['login_user'] = $rsvp;
$updateStmt = null;
}
catch(Exception $e){
$hint = $e;
}
echo $hint;
?>
I definitely have a record in my table with that uniqueId because when I change the query to:
$updateQuery = "UPDATE `db686470460`.`GuestWithPlusOnes` SET `Confirmed`= '1' WHERE `GuestWithPlusOnes`.`UniqueID`= '12345'";
that updates as normal. Is there something else I could be missing?