我有一个表,看起来像下面这样:
但我希望它看起来像这样,以便用户更容易阅读:
我该怎么把它变成那样?下面是当前代码:
<?php
$sql = "SELECT
companyname,
ordernumber,
equipment,
theserial,
type,
theaddress
FROM table";
$result = mysqli_query($con, $sql);
?>
<table id="moreinfotable" name="moreinfotable" class="table table-bordered" style="width:100%">
<thead>
<tr>
<th>Name</th>
<th>OrderNumber</th>
<th>Equipment</th>
<th>Serial</th>
<th>Type</th>
<th>Address</th>
</tr>
</thead>
<?php
while($row = mysqli_fetch_array($result)) {
$companyname = $row['companyname'];
$ordernumber = $row['ordernumber'];
$equipment = $row['equipment'];
$theserial = $row['theserial'];
$type = $row['type'];
$theaddress = $row['theaddress'];
echo '<tr>';
echo '<td>' . $companyname . '</td>';
echo '<td>' . $ordernumber . '</td>';
echo '<td>' . $equipment . '</td>';
echo '<td>' . $theserial . '</td>';
echo '<td>' . $type . '</td>';
echo '<td>' . $theaddress . '</td>';
echo'</tr>';
}
?>
</table>
2条答案
按热度按时间u3r8eeie1#
对于一个固定的类型列表(这里是新的交付和拾取),您可以使用条件聚合直接在SQL中透视数据集:
72qzrwbm2#
我不确定,但你有没有试着订购你的查询?例如:
SELECT * FROM exam ORDER BY exam_date;
这意味着从检查中选择所有并按检查日期排序。