mysql - how to construct this query using php and pdo? -


i have pretty simple query execute. inserting bunch of parts package, , save package, id, , update parts put package id appropriate field.

here how build list of ids need updated:

$ids = []; foreach($packagecontent $value) {     $ids[] = $value->id; } 

then, build query , execute it:

$statement="update tbinv              set                 npackage=:packid             nid in( :idstoupdate )";  $res = $db->prepare($statement); $res->execute(array(":packid" => $packageid, ":idstoupdate" => implode(",", $ids))); 

i putting 2 items in package. id 38 , 39. if file_put_contents trace implode(",", ids), can see 38,39. problem: updates row #38. row #39 not updated.

can point me (probably obvious) mistake? doesn't make sense me, i'm used ms sql server , .net windows application... web development new me, let alone php.

thank you,


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -