1 回答
TA贡献1815条经验 获得超6个赞
在您的foreach块中,您会覆盖$outputtest每次迭代。这意味着只会显示最后一个结果。根据您是要在单独的行上显示每个结果还是要将所有结果放在一个单元格中,您应该在 中创建单元格foreach或将所有结果连接在一起。
编辑:我认为你想要的是:
$querytest = "SELECT o.output_valu, p.amount, p.amount_all, " .
"p.order_id, p.datetime " .
"FROM allusers a inner join order_history o " .
"ON a.account_number = o.account_number " .
"INNER JOIN paymentall p " .
"ON o.output_vl_id = p.output_vl_id " .
"WHERE a.account_number =:account_num " .
"ORDER BY p.datetime ";
$statementtest = $conn->prepare($queryoutgo);
$statementtest->bindParam(':account_num', $account_num);
$statementtest->execute();
$test_result = $statementtest->fetchAll();
?>
<table>
<tr>
<th>Test</th>
</tr>
<?php foreach($test_result as $row) { ?>
<tr><td><?= $row['output_valu']; ?></td></tr>
<?php } ?>
</table>
- 1 回答
- 0 关注
- 94 浏览
添加回答
举报