I'm trying to update a number of rows in MySql with a prepared PDO statement. It doesn't emit any error but the rows remains untouched. What am I doing wrong?
I replaced username, password and database name with xxx for the sake of security when posting on Stack Overflow.
<?php
header('Access-Control-Allow-Origin: *');
$jsonp = false;
error_reporting(E_ALL);
ini_set("display_errors", 1);
$db = new PDO('mysql:host=localhost;dbname=xxx;charset=utf8', 'xxx', 'xxx');
$party = ($_POST['party']);
$id = ($_POST['id']); /* String with ids. Ex. "1, 2, 3" */
$state = ($_POST['state']);
$code = ($_POST['fetchCode']);
$stmt = $db->prepare("UPDATE wishes SET state = :state WHERE fetchCode = :code AND partyID = :party AND id IN (:id)");
$stmt->bindParam(':party', $party);
$stmt->bindParam(':id', $id);
$stmt->bindParam(':state', $state);
$stmt->bindParam(':code', $code);
$stmt->execute();
echo json_encode("Done");
?>