forked from reed-jones/minesweeper_js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetHighScores_example.php
More file actions
94 lines (83 loc) · 2.04 KB
/
Copy pathgetHighScores_example.php
File metadata and controls
94 lines (83 loc) · 2.04 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
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
<?php
//Connect to DB
require("../connect.php");
?>
<!--Build HTML table to hold highscores. This implimentation uses bootstrap -->
<div class="row">
<div class="" id="diffEasy">
<h4>Easy</h4>
<hr>
<div class="row">
<div class="col-xs-6 col-md-6">
<h4>Name</h4>
</div>
<div class="col-xs-6 col-md-6">
<h4>Time</h4>
</div>
<!-- recieve top 10 ranked Easy players -->
<?php $result = pg_query($con, "SELECT name, time FROM _Table_ WHERE difficulty = 0 ORDER BY time, id LIMIT 10");
if (!$result) {
echo "An error occurred.\n";
exit;
}
while ($row = pg_fetch_array($result)) { ?>
<div class="row">
<div class="col-xs-6 col-md-6">
<?php echo $row['name']; ?>
</div>
<div class="col-xs-6 col-md-6">
<?php echo $row['time']; ?>
</div>
</div>
<?php } ?>
</div>
</div>
<div class="" id="diffMedium">
<h4>Medium</h4>
<hr>
<div class="row">
<div class="col-xs-6 col-md-6">
<h4>Name</h4>
</div>
<div class="col-xs-6 col-md-6">
<h4>Time</h4>
</div>
<!--Recieve top 10 ranked Medium players-->
<?php $result = pg_query($con, "SELECT name, time FROM _Table_ WHERE difficulty = 1 ORDER BY time, id LIMIT 10");
while ($row = pg_fetch_array($result)) { ?>
<div class="row">
<div class="col-xs-6 col-md-6">
<?php echo $row['name']; ?>
</div>
<div class="col-xs-6 col-md-6">
<?php echo $row['time']; ?>
</div>
</div>
<?php } ?>
</div>
</div>
<div class="" id="diffHard">
<h4>Hard</h4>
<hr>
<div class="row">
<div class="col-xs-6 col-md-6">
<h4>Name</h4>
</div>
<div class="col-xs-6 col-md-6">
<h4>Time</h4>
</div>
<!--Recieved top 10 ranked Difficult players-->
<?php $result = pg_query($con, "SELECT name, time FROM _Table_ WHERE difficulty = 2 ORDER BY time, id LIMIT 10");
while ($row = pg_fetch_array($result)) { ?>
<div class="row">
<div class="col-xs-6 col-md-6">
<?php echo $row['name']; ?>
</div>
<div class="col-xs-6 col-md-6">
<?php echo $row['time']; ?>
</div>
</div>
<?php } ?>
</div>
</div>
</div>