57 lines
1.6 KiB
PHP
57 lines
1.6 KiB
PHP
<?php
|
|
$tables = DatabaseShowTables();
|
|
$selectedTable = $_GET['table'] ?? null;
|
|
|
|
?>
|
|
|
|
<h2>Datenbank Struktur</h2>
|
|
|
|
<form method="GET">
|
|
<input type="hidden" name="service" value="tabellen">
|
|
|
|
<label for="table">Tabelle auswählen:</label>
|
|
<select name="table" id="table" onchange="this.form.submit()">
|
|
<option value="">-- Bitte wählen --</option>
|
|
<?php foreach ($tables as $table): ?>
|
|
<option value="<?= htmlspecialchars($table) ?>"
|
|
<?= ($selectedTable === $table) ? 'selected' : '' ?>>
|
|
<?= htmlspecialchars($table) ?>
|
|
</option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</form>
|
|
|
|
<?php
|
|
|
|
if ($selectedTable && in_array($selectedTable, $tables)) {
|
|
|
|
$structure = DatabaseShowTableStructure($selectedTable);
|
|
|
|
echo "<h3>Struktur von: " . htmlspecialchars($selectedTable) . "</h3>";
|
|
|
|
echo "<div class='table-container'>";
|
|
echo "<table class='db-table'>";
|
|
echo "<tr>
|
|
<th>Field</th>
|
|
<th>Type</th>
|
|
<th>Null</th>
|
|
<th>Key</th>
|
|
<th>Default</th>
|
|
<th>Extra</th>
|
|
</tr>";
|
|
|
|
foreach ($structure as $column) {
|
|
echo "<tr>";
|
|
echo "<td>" . htmlspecialchars($column['Field']) . "</td>";
|
|
echo "<td>" . htmlspecialchars($column['Type']) . "</td>";
|
|
echo "<td>" . htmlspecialchars($column['Null']) . "</td>";
|
|
echo "<td>" . htmlspecialchars($column['Key']) . "</td>";
|
|
echo "<td>" . htmlspecialchars($column['Default']) . "</td>";
|
|
echo "<td>" . htmlspecialchars($column['Extra']) . "</td>";
|
|
echo "</tr>";
|
|
}
|
|
|
|
echo "</table>";
|
|
echo "</div>";
|
|
}
|
|
?>
|