你好,我把桌子放在这里
此处的屏幕截图
Summary Table Main Table 现在我要在摘要表中,如果“ Menge” = 0,则摘要中不会出现可疑行,这意味着在实际图片中,只有“ 10.95:7”才能显示摘要表的当前表代码
create.topic.policy.class.name
和类函数
<div class="box">
<div class="box-header">
<h3 class="box-title">Zusammenfassung</h3>
</div>
<div class="box-body">
<table class="table table-bordered table-striped">
<tr>
<th>Ware</th>
<th>Menge</th>
</tr>
<tbody>
<tr>
<td>4.95</td>
<td><?php echo $count->countRow($lid, 4.95); ?></td>
</tr>
<tr>
<td>5.95</td>
<td><?php echo $count->countRow($lid, 5.95); ?></td>
</tr>
<tr>
<td>7.95</td>
<td><?php echo $count->countRow($lid, 7.95); ?></td>
</tr>
<tr>
<td>9.95</td>
<td><?php echo $count->countRow($lid, 9.95); ?></td>
</tr>
<tr>
<td>10.95</td>
<td><?php echo $count->countRow($lid, 10.95); ?></td>
</tr>
<tr>
<td>11.95</td>
<td><?php echo $count->countRow($lid, 11.95); ?></td>
</tr>
<tr>
<td>12.95</td>
<td><?php echo $count->countRow($lid, 12.95); ?></td>
</tr>
</tbody>
</table>
</div>
</div>
表格功能可显示带有用户信息的主表格
public function countRow($lid, $price){
$result = $this->sql->query("SELECT count(*) FROM lieferschein2_ware where ean = '$price' and l_id = $lid");
$res = mysqli_fetch_array($result);
if($result->num_rows === 0){
return 0;
}else{
return $res["count(*)"];
}
}
答案 0 :(得分:0)
您需要在每一行之前应用if条件,以检查menge
是否大于0,如下所示:
<div class="box">
<div class="box-header">
<h3 class="box-title">Zusammenfassung</h3>
</div>
<div class="box-body">
<table class="table table-bordered table-striped">
<tr>
<th>Ware</th>
<th>Menge</th>
</tr>
<tbody>
<?php if ($count->countRow($lid, 4.95) > 0) { ?>
<tr>
<td>4.95</td>
<td><?php echo $count->countRow($lid, 4.95); ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
并且您需要为每行应用此if
条件。