-
Notifications
You must be signed in to change notification settings - Fork 0
/
user_list.php
64 lines (59 loc) · 2.01 KB
/
user_list.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
<?
include "header.php";
include "config.php"; //데이터베이스 연결 설정파일
include "util.php"; //유틸 함수
?>
<div class="container">
<?
$connect = dbconnect($host, $dbid, $dbpass, $dbname);
mysqli_autocommit($connect,FALSE); //disable auto-commit
mysqli_query($connect, "set session transaction isolation level serializable"); // set session consistency level to serializable
mysqli_begin_transaction($connect, MYSQLI_TRANS_START_READ_ONLY); // set transaction as read only because it only reads from table
?>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>No.</th>
<th>Username</th>
<th>Team</th>
<th>Win rate</th>
<th>K/D</th>
<th>Most kill</th>
</tr>
</thead>
<tbody>
<?
$result = mysqli_query($connect, "select * from user order by win_rate desc");
if(!$result){
mysqli_rollback($connect); // If failure happens, rollback
}else{
mysqli_commit($connect); // If no error happens, leave commit
}
$rownum = mysqli_num_rows($result);
for($i = 0; $i<$rownum; $i++){
$row = mysqli_fetch_array($result);
echo "<tr>";
echo "<td>$i</td>";
echo "<td>
<a href='user_detail.php?username=".$row['username']."'>{$row['username']}</a>
</td>";
echo "<td>
<a href='team_detail.php?team=".$row['team']."'>{$row['team']}</a>
</td>";
// echo "<td>{$row['team']}</td>";
echo "<td>{$row['win_rate']}</td>";
echo "<td>{$row['kill_death']}</td>";
echo "<td>{$row['most_kill']}</td>";
echo "<td width='10%'>
<a href='user_form.php?username=".$row['username']."'><button class='button primary small'>Modify</button></a>
</td>";
echo "<td width='10%'>
<a href='user_delete.php?username=".$row['username']."'><button class='button danger small'>Delete</button></a>
</td>";
echo "</tr>";
}
?>
</tbody>
</table>
</div>
<? include("footer.php") ?>