just need help regarding my program.
anyway i have the following data in array.
0 - 10 - desc1 - 1 - PCS - 11 - I1 - 0060000714 - 0020730027
1 - 20 - desc2 - 2 - BOX - 44 - I1 - 0060000714 - 0020730027
2 - 30 - desc3 - 3 - PER - 99 - DI - 0060000715 - 0020730027
3 - 40 - desc4 - 4 - PCS - 176 - I1 - 0060000714 - 0020730027
4 - 50 - desc5 - 5 - BOX - 275 - I1 - 0060000714 - 0020730027
5 - 60 - desc6 - 6 - PCS - 396 - I1 - 0060000714 - 0020730027
what i did is i use foreach
foreach($result as $tmp){
$po_item_no = $tmp['item_no'];
$po_details = $tmp['item_desc'];
$po_details = urlencode($po_details);
$unit = $tmp['item_unit'];
$qty = $tmp['item_qty'];
$unit_price = $tmp['item_amt'];
$net_price = $unit_price * $qty;
echo $po_item_no.' - '.$po_details.' - '.$qty.' - '.$unit.' - '.$net_price.'<br>';
}
the above code works properly and echos the value.
but whenever i use this code it only shows me 1 line and terminate it after.
$item = new PO_Item();
foreach($result as $tmp){
$po_item_no = $tmp['item_no'];
$po_details = $tmp['item_desc'];
$po_details = urlencode($po_details);
$unit = $tmp['item_unit'];
$qty = $tmp['item_qty'];
$unit_price = $tmp['item_amt'];
$net_price = $unit_price * $qty;
echo $po_item_no.' - '.$po_details.' - '.$qty.' - '.$unit.' - '.$net_price.'<br>';
$item->addToItem(_Item::__set_state(
array(
'PO_ITEM' => $po_item_no,
'SHORT_TEXT' => $po_details,
'PLANT' => $plant,
'MATL_GROUP' => '1234',
'QUANTITY' => $qty,
'PO_UNIT' => $unit,
'NET_PRICE' => $net_price,
'ACCTASSCAT' => 'Z'
)
));
}
that code only show 1 record and not displaying the 6 record.
what do you think is wrong with my code?
thanks in advance.