-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdb.php
More file actions
45 lines (30 loc) · 1.14 KB
/
db.php
File metadata and controls
45 lines (30 loc) · 1.14 KB
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
<?php
//* Tämä skripti käyttää slave-tietokantapalvelinta *//
$useslave = 1;
require "inc/parametrit.inc";
echo "<table><tr><td valign='top' class='back'>";
$query = "SHOW FULL TABLES FROM `$dbkanta` WHERE Table_Type = 'BASE TABLE'";
$result = pupe_query($query);
while ($row=mysqli_fetch_array($result)) {
echo "<a href='$PHP_SELF?table=$row[0]'>$row[0]</a><br>";
}
echo "</td><td class='back' valign='top'>";
if ($table!='') {
$query = "show columns from $table";
$fields = pupe_query($query);
echo "<b>$table</b> (<a href='db.php?table=$table'>table</a> - <a href='db-index.php?table=$table'>index</a>)<br><br>";
echo "<table>";
echo "<tr><th>field</th><th>type</th><th>null</th><th>key</th><th>default</th><th>extra</th></tr>";
$kala = array();
while ($row=mysqli_fetch_array($fields)) {
//tehdään array, että saadaan sortattua nimen mukaan..
array_push($kala, "<tr><td>$row[0]</td><td>$row[1]</td><td>$row[2]</td><td>$row[3]</td><td>$row[4]</td><td>$row[5]</td></tr>");
}
sort($kala);
foreach ($kala as $rivi) {
echo "$rivi";
}
echo "</table>";
}
echo "</td></tr></table>";
require "inc/footer.inc";