-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhdi.php
91 lines (79 loc) · 2.98 KB
/
hdi.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>HDI</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<link rel="stylesheet" href="/static/style.css">
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
</head>
<body>
<nav class="navbar navbar-dark bg-info">
<div class="container">
<a href="index.php" class="navbar-brand">Hot War Score</a>
<form class="form-inline" name = "search" onsubmit = "return validateForm()" method = "post" action = "search.php">
<input class="form-control mr-sm-2" name = "country" type="text" placeholder="Country" aria-label="Search">
<button class="btn btn-outline-light my-2 my-sm-0" type="submit">search</button>
</form>
</div>
</nav>
<body bgcolor="#EDEDED">
<ol start="1"></br>
<h3><span style="background-color: #B5B5B5;"><b>人類發展指數</b></span> </h3>
<p>是聯合國開發計劃署從1990年開始發布的一個指數,用以衡量各國社會經濟發展程度的標準,</p>
<hr>
</br>
<table class="table-responsive align-middle mb-0 bgcolor=black cellpadding=5 border=1">
<thead class="bg-info">
<tr>
<?php
$records_per_page = 10;
if (isset($_GET['page'])){
$page = $_GET['page'];
}else{
$page = 1;
}
$link = mysqli_connect("localhost:3307",'root','','finaldatabase');
$sql= "SELECT * FROM development";
if ($result=mysqli_query($link,$sql)) {
$total_fields=mysqli_num_fields($result);
$total_records=mysqli_num_rows($result);
$total_pages=ceil($total_records / $records_per_page);
$offset = ($page - 1)*$records_per_page;
mysqli_data_seek($result, $offset);
print('總筆數:'.$total_records);
while ( $meta=mysqli_fetch_field($result) ) {
echo "<td bgcolor=#00B2B2>". $meta->name ."</td>";
}
$j = 1;
while ($rows = mysqli_fetch_array($result, MYSQLI_NUM) and $j <= $records_per_page ) {
echo "<tr>";
for ( $i = 0; $i<= $total_fields-1; $i++ )
echo "<td bgcolor=white>".$rows[$i]."</td>";
echo "</tr>";
$j++; }
echo "</table><br>";
if ( $page > 1 )
echo "<a href='hdi.php?page=".($page-1).
"'>上一頁</a>| ";
for ( $i = 1; $i <= $total_pages; $i++ )
if ($i != $page)
echo "<a href=\"hdi.php?page=".$i."\">".
$i."</a> ";
else
echo $i." ";
if ( $page < $total_pages )
echo "|<a href='hdi.php?page=".($page+1).
"'>下一頁</a> ";
}
mysqli_free_result($result);
mysqli_close($link);
?>
<hr>
<h3>資料來源:</h3>
<a href="https://www.kaggle.com/code/valchovalev/does-hdi-education-impact-wealth-gni-2021/data">Does HDI & Education impact Wealth & GNI 2021 ?</a>
</body>
</html>