New error popping up when upgraded to CI 3.1.2.
Code:
Error Number: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'THEN '1109' ELSE `wopart_id` END, `qty` = CASE WHEN `wopart_id` = THEN '2' ELS' at line 2
UPDATE `WOPARTS` SET `wopart_id` = CASE WHEN `wopart_id` = THEN '1109' ELSE `wopart_id` END, `qty` = CASE WHEN `wopart_id` = THEN '2' ELSE `qty` END, `price` = CASE WHEN `wopart_id` = THEN '59.40' ELSE `price` END WHERE `wopart_id` IN()
Filename: models/Transaction_model.php
Line Number: 131
This is the section of Transaction_model in question. Nothing in the model changed but somehow the insert_batch function is not working right with the latest update. Any ideas?
Code:
$this->load->model('parts_model');
if($this->input->post('woPartsEdit') ){
$woPartsEdit = $this->input->post('woPartsEdit');
if(isset($woPartsEdit['wopart_id'])){
$update_data = array();
foreach($woPartsEdit['wopart_id'] as $key => $val){
if(isset($woPartsEdit['qty'][$key]) && isset($woPartsEdit['price'][$key]) ){
$update = array();
$update['wopart_id'] = $val;
$update['qty'] = $woPartsEdit['qty'][$key];
$update['price'] = $woPartsEdit['price'][$key];
$update_data[] = $update;
}
}
if(count($update_data) > 0) $this->db->update_batch('WOPARTS', $update_data, 'wopart_id');
}
}