0

I have array of data like below:

$data = Array
(
    [0] => Array
        (
            [id] => 29
            [value_1] => 1
            [value_2] => 1
            [value_3] => 1
        )

    [1] => Array
        (
            [id] => 116
            [value_1] => 1
            [value_2] => 1
            [value_3] => 1
        )

)

and i have to update it like in update query where in the id matched then set the only particular values for that. suppose my query like this

update table set value1 = $data[matched_id_index]['value_1'],value2 = $data[matched_id_index]['value_2'],value3 = $data[matched_id_index]['value_3'] where id in (data[0]['id'],$data[1]['id]);

Means basically i need to update the matched id value for particular column.

0 Answers0