-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
69 lines (62 loc) · 2.54 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
58
59
60
61
62
63
64
65
66
67
68
69
<!DOCTYPE html>
<html>
<head>
<title>Source Database Information</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<?php
$conn = pg_connect("host=localhost port=5432 dbname=data_warehouse user=postgres password=postgres");
$sql = "SELECT * FROM \"group\";";
echo "<h3>----------------------------------GROUP TABLE----------------------------------</h3>" . "<br>";
$result = pg_query($conn, $sql);
$resultCheck = pg_num_rows($result);
if ($resultCheck > 0) {
while ($row = pg_fetch_assoc($result)) {
echo "name: " . $row['name'] . "<br>";
echo "location: " . $row['location'] . "<br>";
echo "classification: " . $row['classification'] . "<br>";
echo "group_uid: " . $row['group_uid'] . "<br>";
echo "<br>";
}
}
$sql = "SELECT * FROM source;";
echo "<h3>----------------------------------SOURCE TABLE----------------------------------</h3>" . "<br>";
$result = pg_query($conn, $sql);
$resultCheck = pg_num_rows($result);
if ($resultCheck > 0) {
while ($row = pg_fetch_assoc($result)) {
echo "source_uid: " . $row['source_uid'] . "<br>";
echo "name: " . $row['name'] . "<br>";
echo "group_uid: " . $row['group_uid'] . "<br>";
echo "tz_info: " . $row['tz_info'] . "<br>";
echo "<br>";
}
}
$sql = "SELECT * FROM metric;";
echo "<h3>----------------------------------METRIC TABLE----------------------------------</h3>" . "<br>";
$result = pg_query($conn, $sql);
$resultCheck = pg_num_rows($result);
if ($resultCheck > 0) {
while ($row = pg_fetch_assoc($result)) {
echo "metric_uid: " . $row['metric_uid'] . "<br>";
echo "source_uid: " . $row['source_uid'] . "<br>";
echo "data_type: " . $row['data_type'] . "<br>";
echo "units: " . $row['units'] . "<br>";
echo "name: " . $row['name'] . "<br>";
echo "asc: " . $row['asc'] . "<br>";
echo "<br>";
}
}
// $tables = "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' AND table_type = 'BASE TABLE' AND table_name != 'metric' AND table_name != 'source' AND table_name != 'group';";
// echo "<h3>----------------------------------CREATED TABLES----------------------------------</h3>" . "<br>";
// $result = pg_query($conn, $tables);
// $resultCheck = pg_num_rows($result);
// if ($resultCheck > 0) {
// while ($row = pg_fetch_assoc($result)) {
// echo $row['table_name'] . "<br>";
// }
// }
?>
</body>
</html>