我想用我的表体安排表头,所以数据填充有相同的类型,我该怎么做?
The black square is the correct one
这是我的代码
<table>
$syntax = 'SELECT customer,type, count(type) as num FROM view_detail GROUP BY type ORDER BY customer';
$rows = $config->prepare($syntax);
$rows->execute();
$result = $rows->fetchAll(PDO::FETCH_OBJ);
?>
</tr>
<td>No</td>
<td>Customer</td>
<?php for($x=0;$x<count($result);$x++){ ?>
<td><?php echo $result[$x]->type; ?></td>
<?php } ?>
<td>Total</td>
<?php $no = 1;
$query = 'SELECT customer,type, count(type) as tipe FROM view_detail GROUP BY customer ORDER BY customer';
$baris = $config->prepare($query);
$baris->execute();
$hasil1 = $baris->fetchAll(PDO::FETCH_OBJ);
for($i=0;$i<count($hasil1);$i++){
$sql = 'SELECT * FROM view_detail WHERE customer = "'.$hasil1[$i]->customer.'" ORDER BY customer';
$row = $config->prepare($sql);
$row->execute();
$hasil = $row->fetchAll(PDO::FETCH_OBJ);
?>
<tr>
<td><?php echo $no; $no++;?></td>
<td><?php echo $hasil[$i]->customer; ?></td>
<?php
for($y=0;$y<count($result);$y++){
if($y < count($hasil)){
?>
<td><?php echo $hasil[$y]->type; ?></td>
<?php }else{ ?>
<td>0</td>
<?php } } }?>
</tr>
</table>
由于
编辑: Dynatrade - &gt; MFN200,N50Z和N70 超级绽放 - &gt; N70,MFN100,MFN120和MFN150