我正在尝试在HTML表中显示数据库中的数据。主要问题是:该表未出现。
<html>
<head>
<body>
<table>
<tr>
<th>Id</th>
<th>String</th>
<th>Array</th>
</tr>
<?php
// Mostrar dados
echo "<table>";
{
$databaseName = 'visteon';
$pdo = new Pdo('mysql:host=127.0.0.1;dbname=' . $databaseName, 'root', '');
$result = $pdo->query('SHOW TABLES FROM ' . $databaseName)->fetchAll(PDO::FETCH_NUM);
$Tabela = [];
foreach ($result as $r) {
$Tabela[] = $r[0];
}
$data = [];
foreach ($Tabela as $Tabela) {
$data[$Tabela] = $pdo->query('SELECT * FROM ' . $Tabela)->fetchAll(PDO::FETCH_ASSOC);
}
echo "</table>";
var_dump($Tabela);
var_dump($data);
}
?>
</table>
</body>
</html>
MM们
拉丁的传说