我有以下用于在 PHP 中显示 MySQL 查询的语法:
function get_dayssincecapture($db)
{
$result = $db->query("SELECT DATEDIFF(now(), sarrive)as days,count(loadnumber) as loads from v2loads where adminstatus='captured' group by DATEDIFF(now(), sarrive) ");
return $result;
}
$dayssincecapture = get_dayssincecapture($db);
显示语法:
<table border=1>
<tr>
<? while($row = $dayssincecapture->fetch(PDO::FETCH_ASSOC)) { ?>
<td><? echo $row['days']; ?><br><? echo $row['loads']; ?></td>
<? } ?>
</tr>
</table>
这会产生以下屏幕输出
如何通过表语法进行更改,以便将天字段作为行标题,将负载字段作为表的第二行?
所以我想要的是:
一如既往地感谢,