我想从数组中的数组中提取数据。但问题是,当我使用 key 功能时,它会覆盖第一个条目。我希望得到 135 行的结果,但它只给我 114 行。
下面是我遇到问题的代码..
while($row1 = mssql_fetch_array($result1)) {
$mycount = $mycount + 1;
$boskey = $row1["EAN11"]."^".$row1["AUART"];
$boskey1 = $row1["ORDNUM"]."^".$row1["ERDAT"]."^".$row1["KUNAG"]."^".$row1["NAME1"]."^".$row1["PERNR"]."^".$row1["FKIMG"]."^".$row1["BASEPRICE"]."^".$row1["NETPRICE"]."^".$row1["ZZMAXDISC"]."^".$row1["MVGR1"]."^".$row1["KDGRP"];
$bos[$boskey][$boskey1] = $bos[$boskey][$boskey1];
}
for ($i = 0; $i < count($bos); $i++) {
$abc = key($bos);
$arr = explode("^",$abc);
$ean11 = $arr[0];
$auart = $arr[1];
echo $ean11 . " - " . $auart;
for ($j = 0; $j < count($bos[$abc]); $j++) { //total count of $bos[$abc] is 114.
$xxx = key($bos[$abc]);
$arr1 = explode("^",$xxx);
$ordnum = $arr1[0];
$docdate = $arr1[1];
$customer = $arr1[2];
$name1 = $arr1[3];
$ae = $arr1[4];
$qty = $arr1[5];
$baseprice = $arr1[6];
$netprice = $arr1[7];
//$discount = $arr1[8];
$booktype = $arr1[9];
$kdgrp = $arr1[10];
$discount = 100 - (100 * ( $netprice / $baseprice));