배열에 대한 루프를 생성 한 후 다음에 업데이트 일괄 처리를 수행하지만 항목을 업데이트하려고 할 때마다 코드가 업데이트되지 않습니다. 나는 내 잘못이 어디에 있는지 눈치 채지 못한다. 쉬운 방법으로 업데이트 배치를 수행하려면 어떻게해야합니까?Codeigniter의 일괄 처리 오류 업데이트
/*THIS IS ALL ARRAY*/
$id = $this->input->post('idx');
$desc = $this->input->post('itemdesc');
$qty = $this->input->post('qty');
$price = $this->input->post('price');
$status = $this->input->post('status');
for($x = 0; $x < sizeof($id); $x++){
$total[] = $price[$x] * $qty[$x];
$updateArray[] = array(
'poid' => $id[$x],
'item_desc' => $desc[$x],
'item_qty' => $qty[$x],
'price' => $price[$x],
'total' => $total[$x],
'status' => $status[$x]
);
$this->db->update_batch('po_order_details',$updateArray, 'poid'); //I guess poid is my error but im not sure. I think my array won't find the correct id for where.
}
가 여기 내 배열 샘플 출력입니다 : 난 당신이 날 도울 수 있기를 바랍니다 모든 사람을의
Array
(
[0] => Array
(
[poid] => 5
[item_desc] => Yakisoba
[item_qty] => 15
[price] => 40,000.00
[total] => 600
[status] => ACTIVE
)
[1] => Array
(
[poid] => 6
[item_desc] => Laptop
[item_qty] => 5
[price] => 15,000.00
[total] => 75
[status] => ACTIVE
)
[2] => Array
(
[poid] => 7
[item_desc] => Speaker
[item_qty] => 3
[price] => 5,000.00
[total] => 15
[status] => ACTIVE
)
[3] => Array
(
[poid] => 8
[item_desc] => Mouse
[item_qty] => 5
[price] => 500.00
[total] => 2500
[status] => ACTIVE
)
[4] => Array
(
[poid] => 9
[item_desc] => Keyboard
[item_qty] => 5
[price] => 1,000.00
[total] => 5
[status] => ACTIVE
)
)
여기 내 코드입니다.
길이 :
– Red또한 루프 내부에서 업데이트하는 것처럼 보입니다. 루프를 통해 배열을 만들고 있으므로 루프가 완료된 후에 업데이트를 실행해야합니다. – Red
업데이트 할 때마다 데이터를 업데이트 할 수 없습니다. – Jerielle