如何使用php和pdo构建此查询? [重复]

I have a pretty simple query to execute. I am inserting a bunch of parts into a package, and then I save my package, get its ID, and then update all my parts to put the package ID into the appropriate field.

Here is how I build my list of IDs that need to be updated:

$IDs = [];
foreach($packageContent as $value) {
    $IDs[] = $value->ID;
}

Then, I build my query and execute it:

$statement="UPDATE tbInv 
            SET
                nPackage=:packID
            WHERE nID IN( :IDsToUpdate )";

$res = $db->prepare($statement);
$res->execute(array(":packID" => $packageID, ":IDsToUpdate" => implode(",", $IDs)));

I am putting two items in my package. ID 38 and 39. If I do a file_put_contents to trace my implode(",", IDs), I can clearly see 38,39. The problem: it only updates the row #38. Row #39 does NOT get updated.

Can somebody point me to my (probably obvious) mistake? It just doesn't make any sense to me, I'm used to MS SQL Server and a .net windows application... Web development is new to me, let alone PHP.

Thank you,

</div>