0

I am doing update the table values of multiple rows. So i using the query is

UPDATE `notification` SET `flag`='1' WHERE id IN (1,2,3,4)

Where it is working as fine. But don't how to use it in php. My php code ishown below.

  $json = '[{"id":"1"},{"id":"2"},{"id":"3"}]';
  $arr = json_decode($json);

if(is_array($arr)){
    $sql = "UPDATE `notification` SET `flag`='1' WHERE id IN (1,2,3,4)";

    // I want to implement the code is here.
}

Here, 1234 is the id. The id is parsing from json. But how apply in mysql query. please help me?

Fazil
  • 109
  • 1
  • 2
  • 8

0 Answers0