我正在尝试通过循环将 PDO 结果显示在表格中。但是目前它只是显示一个白页。对缺少的内容有什么建议吗?或者为什么页面是空白的?
<?php
try { $conn = new PDO("pgsql:host=localhost port=5432 dbname=riverflies_gis", "opengeo", "opengeo");
echo "PDO connection object created";
echo "<br>";
}
catch(PDOException $e) {
echo $e->getMessage();
}
$sql = "SELECT admin_name, adminuser_id, group_id FROM adminuser_tbl";
$stmt = $conn->prepare($sql);
$stmt->execute();
$data = $stmt->fetchAll();
?>
<table border='1' cellpadding='10'>
<tr>
<th>ID</th>
<th>adminuser</th>
<th>group_id</th>
<th></th>
</tr>
<?php foreach ($data as $row): ?>
<tr>
<td><?=$row['adminuser_id']?></td>
<td><?=$row['admin_name']?></td>
<td><?=$row['group_id']?></td>
</tr>
<?php endforeach ?>
</table>