我有一个无法编辑的查询,它在 if 语句上输出一个数组,并根据变量的值输出到可打印的 html 页面(作为带有分页符的表),但我需要进一步研究数组以便它根据键的不同值的数量输出多张带分页符的工作表。
if($Guide=='N'){
$decisionN[$j] = array(
'Qty'=>$Qty ,
'Comments'=>$Notes,
'Location'=>$Location,
'GuideRef'=>$GuideRef ,
);
$j++;
}
接着
<?php
}
if ($decisionN){
$Guide2="N"
?>
Checkin for <?php echo $Guide2;?>
<!--</div>-->
<table class="tablesorter" id="guides" style="border: 1px solid black;">
<thead>
<tr>
<!--<th style="width: 15px;">PO</th> -->
<th style="width: 5px;">Qty</th>
<th style="width: 15px;">COMMENTS</th>
<th style="width: 10px;">LOCATION</th>
<th style="width: 12px;">GUIDEREF</th>
</tr>
</thead>
<tbody>
<?php foreach($decisionN as $v){
echo "<tr>";
foreach($v as $vv){
echo "<td>{$vv}</td>";
}
echo "<tr>";
}
?> </tbody><tfoot> </tfoot> </table></div> </div> <footer>Checkin List</footer>
完美地工作并在下一个指南值的页脚后中断,我需要的是根据 $GuideRef 将 $decisionN 划分为不同的数组(可能是 $GuideRef 的 10 个不同值,每个 $GuideRef 可能有 100 个“行”)我试过了几个不同的 foreach 语句,但没有任何想法?