-1
컨트롤러에서 다차원 배열을 codeigniter에서 보는 방법으로 전달하는 방법. 컨트롤러에서 출력되고 있지만보기에 전달하는 동안 오류가 발생합니다. 내 배열 결과 :codeigniter에서 다차원 배열에 액세스하는 방법
Array (
[0] => Array ([PcountID] => 1 [PcountNAME] => Abayas [Pcount] => 8 [ScountID] => 1 [ScountNAME] => Abayas [Scount] => 9)
[1] => Array ([PcountID] => 3 [PcountNAME] => Hytaf [Pcount] => 16 [ScountID] => 3 [ScountNAME] => Hytaf [Scount] => 13)
[2] => Array ([PcountID] => 5 [PcountNAME] => Rida [Pcount] => 2 [ScountID] => 6 [ScountNAME] => sss [Scount] => 3)
[3] => Array ([PcountID] => 6 [PcountNAME] => sss [Pcount] => 7)
)
내 컨트롤러 코드 : 뷰에 배열 결과 이러한 유형의 액세스하는 방법
for($i = 0 ; $i<$CinventoryP; $i++)
{
for($j = 0; $j<$CinventoryPR; $j++)
{
if($inventoryP[$i]['product_id'] == $inventoryPR[$j]['product_id'])
{
$jj = $j;
$flag = 1;
break;
}
else{
$flag=0;
$jj = $j;
}
}
if($flag==1)
{
$outs[$i]['PcountID'] = $inventoryP[$i]['product_id'];
$outs[$i]['PcountNAME'] = $inventoryP[$i]['product_name'];
$outs[$i]['Pcount'] = $inventoryP[$i]['purchase_count'] - $inventoryPR[$jj]['purchase_returns_count'];
}
else{
$outs[$i]['PcountID'] = $inventoryP[$i]['product_id'];
$outs[$i]['PcountNAME'] = $inventoryP[$i]['product_name'];
$outs[$i]['Pcount'] = $inventoryP[$i]['purchase_count']."<br>";
}
}
$this->load->view('inventory/view_inventory_report',$out);
. 도와주세요. 컨트롤러 파일에서