每当我使用嵌套循环时,我就在Codeigniter上工作,本地主机无法处理我的请求。现在我改变了我的代码策略,但是遇到了同样的问题。这次我使用for循环创建函数。 我想从两个不同的查询中获取结果以匹配嵌套循环中的列或通过使用Function 附加了代码
<table class="table table-bordered table-responsive">
<?php if($allow_array ->result()){ ?>
<thead class="thead" >
<th style="width: 10%">Employee Number</th>
<th style="width: 10%">Employee Name</th>
<th style="width: 10%">Location</th>
<th style="width: 10%">Category</th>
<th style="width: 10%">Extra Work Allowance</th>
<th style="width: 10%">Hardship Allowance</th>
<th style="width: 10%">Shift Allowance</th>
<th style="width: 10%">Relocation Allowance</th>
<th style="width: 10%">Production Allowance</th>
<th style="width: 10%">Special Allowance Zin/KUP</th>
</thead>
<?php }?>
<tbody class="tbody">
<?php
$cat=" ";
$loc=" ";
$ewa=0;
$hsa=0;
$sa=0;
$ra=0;
$pa=0;
$sazk=0;
function values($cat,$loc,$ewa,$hsa,$sa,$ra,$pa,$sazk,$allow_array)
{
foreach ($allow_array->result() as $allow) {
?>
<tr>
<td style="width: 10%"><?php echo $allow->emp_no; ?></td>
<td style="width: 10%"><?php echo $allow->emp_name; ?></td>
<td style="width: 10%"><?php echo $allow->loc_name; ?></td>
<td style="width: 10%"><?php echo $allow->category; ?></td>
<td style="width: 10%">
<?php if (($allow->category == $cat) && ($allow->loc_name == $loc) && ($ewa > 0)) { ?>
<input size="5" type="number" min="0" max="99"
value="<?php echo $allow->extra_work_allowance; ?>"
name="">
<?php } ?>
</td>
<td style="width: 10%">
<?php if (($allow->category == $cat) && ($allow->loc_name == $loc) && ($hsa > 0)) { ?>
<input size="5" type="number" min="0" max="1"
value="<?php echo $allow->hardship_allowance; ?>"
name="">
<?php } ?>
</td>
<td style="width: 10%">
<input size="5" type="number" min="0" max="99"
value="<?php echo $allow->shift_allowance; ?>"
name="">
</td>
<td style="width: 10%">
<input size="5" type="number" min="0" max="1"
value="<?php echo $allow->relocation_allowance; ?>"
name="">
</td>
<td style="width: 10%"><input size="5" type="number" min="0" max="99"
value="<?php echo $allow->production_allowance; ?>"
name=""></td>
<td style="width: 10%"><input size="5" type="number" min="0" max="99"
value="<?php echo $allow->special_allowance_zin_kup; ?>"
name=""></td>
<input type="hidden" value="<?php echo $allow->emp_no ?>" name="empname">
</tr>
<?php
}
}
foreach ($allowed_allowances as $allowances) {
$cat = $allowances->category;
$loc = $allowances->loc_name;
$ewa = $allowances->extra_work_allowance;
$hsa = $allowances->hardship_allowance;
$sa = $allowances->shift_allowance;
$ra = $allowances->relocation_allowance;
$pa = $allowances->production_allowance;
$sazk = $allowances->special_allowance_zin_kup;
values($cat,$loc,$ewa,$hsa,$sa,$ra,$pa,$sazk,$allow_array);
}
?>
</tbody>
</table>
我也尝试配置Xampp Server,但不能解决问题
答案 0 :(得分:0)
您应该尝试启用错误报告或检查apache错误日志,以便您可以详细了解代码出了什么问题。