Code:
$dataTotal = array(
array(
'id' => 1,
'name' => 'house',
'description' => 'this house'
),
array(
'id' => 2,
'name' => 'car',
'description' => 'black car'
)
);
$this->function_model->updateData($dataTotal);
public function updateData($data=NULL){
$this->db->update_batch('mytable',$data,'id');
}
// Produces:
// UPDATE `mytable` SET `name` = CASE
// WHEN `id` = THEN 'house'
// WHEN `id` = THEN 'car'
// ELSE `name` END,
// `description` = CASE
// WHEN `id` = THEN 'this house'
// WHEN `id` = THEN 'black car'
// ELSE `description` END
// WHERE `id` IN (1,2)
With the new update the system does not capture the value of index.