-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
57 lines (53 loc) · 2.24 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
require_once "Utility.php";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Database</title>
<?php bootstrap(); ?>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-9">
<h1>Elenco tabelle di <?php echo $dbname ?></h1>
</div>
<div class="col align-self-center">
<a href="Table.php" class="btn btn-secondary w-100">Crea tabella</a>
</div>
</div>
<div class="row">
<?php
$sql = "SHOW TABLES";
$result = query($sql);
if (!is_null($result) and $result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$table = $row["Tables_in_$dbname"];
$sql = "SHOW COLUMNS FROM $table";
$columns = query($sql);
echo "<div class=\"card\" style=\"width: 18rem;\">
<div class=\"card-header\">$table</div>
<ul class=\"list-group list-group-flush\">";
while ($column = $columns->fetch_assoc()) {
echo "<li class=\"list-group-item\">" . $column["Field"] . "</li>";
}
echo "</ul>
<div class=\"form-group\" style=\"margin: 5% 0 5% 0\">
<div class=\"row d-flex justify-content-center text-center\">
<a href=\"Add.php?table=$table\" class=\"btn btn-primary col-md-5\">Aggiungi</a>
<a href=\"View.php?table=$table\" class=\"btn btn-success col-md-5\">Visualizza</a>
</div><div class=\"row d-flex justify-content-center text-center\">
<a href=\"Search.php?table=$table\" class=\"btn btn-info col-md-5\">Cerca</a>
<a href=\"Interact.php?table=$table&action=drop\" class=\"btn btn-danger col-md-5\">Elimina</a>
</div></div></div>";
}
}
?>
</div>
</div>
</body>
</html>