No idea why this won't work. I do a SELECT on the same database following the exact same procedure (ie prepare,bind,execute). But the update for some reason will not update in the the DB.
Here is the code :
$stmtUpdate = $mysqli->prepare("UPDATE license_keys.$injection_key_text_type
SET given_date = CURRENT_DATE(), contact_email = ?, given_bool = ?, contact_id = ?
WHERE key_text_id = ?;";
$stmtUpdate->bind_param("siss",$recipient_email,1,$contact_id,$key_text_id);
$stmtUpdate->execute();
$stmtUpdate->close();
Things I've tried
- Wrapping the first line in an if statement
- Switched
given_date = CURRENT_DATE
togiven_date = ?
then just added an arbitrary string to my bind params ie ($stmtUpdate->bind_param("ssiss","11-8-2014",$recipient_email,1,$contact_id,$key_text_id);
- tried it with and without the ";" at the end of the statement because it works with the procedural version but not the OO way.
Also Note if I run it as procedural it works just fine, but I need it to work using prepared statements. Here is the procedural code:
$mysqli->query("UPDATE license_keys.$injection_key_text_type
SET given_date = CURRENT_DATE(), contact_email = '$recipient_email', given_bool = 1, contact_id = '$contact_id'
WHERE key_text_id = '$key_text_id';");