Either
// Get your status
$item = array( 'Status' => $response['Status'] );
// unset status
unset($response['Status']);
// I assume except status rest all values are ids so
// array_values gives id
$this->db->where_in('id', array_values($response));
// Update table
$this->db->update('table', $item );
OR
You have to modify your array
$data = array(
array(
'id' => 1 ,
'Status' => 'Done'
),
array(
'id' => 2 ,
'Status' => 'Done'
)
);
and then
$this->db->update_batch('table_name', $data, 'id');
Like this you can modify
( for comment : Dear I cant do so, because I am getting response from some service. And I am not able to edit this response. )
[akshay@localhost tmp]$ cat test.php
<?php
$response = array(
'ID1' => 1 ,
'ID2' => 2,
'Status' => 'Done'
);
$data = array();
$item = array( 'Status' => $response['Status'] );
unset($response['Status']);
foreach($response as $new){
$item['id'] = $new;
$data[] = $item;
}
print_r($data);
// Here you update
// $this->db->update_batch('table_name', $data, 'id');
?>
Output
[akshay@localhost tmp]$ php test.php
Array
(
[0] => Array
(
[Status] => Done
[id] => 1
)
[1] => Array
(
[Status] => Done
[id] => 2
)
)