Files
Backend/WEBROOT/services/tabellen.php
T

54 lines
1.4 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 "<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>" . ($column['Field']) . "</td>";
echo "<td>" . ($column['Type']) . "</td>";
echo "<td>" . ($column['Null']) . "</td>";
echo "<td>" . ($column['Key']) . "</td>";
echo "<td>" . ($column['Default']) . "</td>";
echo "<td>" . ($column['Extra']) . "</td>";
echo "</tr>";
}
echo "</table>";
echo "</div>";
}
?>