-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdata.php
199 lines (183 loc) · 10.9 KB
/
data.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SmartATK</title>
<!-- Bootstrap -->
<!-- If you are online, or will deploy this to server, uncomment this part
<!-- Latest compiled and minified CSS
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- Optional theme
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
-->
<!-- If you are offline, uncomment this part -->
<!-- CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/bootstrap-theme.min.css" rel="stylesheet">
<link href="css/font-awesome.min.css" rel="stylesheet">
<link href="css/bootstrap-social.css" rel="stylesheet">
<link href="css/mystyles.css" rel="stylesheet">
<!-- jQuery -->
<script src="js/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class ="row row-header">
<div class="col-xs-12 col-sm-4 col-sm-offset-8">
<h1 id="title">SmartATK</h1>
</div>
</div>
<div class="row row-content">
<div class="col-xs-12 col-sm-3">
<button type="button" class="navbar-toggle collapse" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="navbar-collapse collapse" id="navbar">
<ul class="nav nav-pills nav-stacked na">
<li><a href="editstock.php">Edit Data Stok</a></li>
<li><a href="usage.php">Pemakaian ATK</a></li>
<li class="active"><a href="data.php">Lihat Data</a></li>
<li><a href="stats.php">Statistik</a></li>
</ul>
</div>
</div>
<div class="col-xs-12 col-sm-9">
<div class="row row-content">
<div class="col-xs-12">
<h2>Lihat Data</h2>
</div>
<div class="col-xs-12 col-sm-4" style="text-align:center;">
<a href="data.php?type=atk"><button class="btn btn-primary">ATK</button></a>
</div>
<div class="col-xs-12 col-sm-4" style="text-align:center;">
<a href="data.php?type=user"><button class="btn btn-primary">User</button></a>
</div>
<div class="col-xs-12 col-sm-4" style="text-align:center;">
<a href="data.php?type=usage"><button class="btn btn-primary">Pemakaian</button></a>
</div>
<?php
$servername = "localhost";
$username = "root";
$dbname = "smartatk";
$conn = new mysqli($servername, $username, "", $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$data = "na";
if (isset($_GET["type"])) {
$data = $_GET["type"];
}
?>
<div class="col-xs-12">
<p style="padding-bottom:20px;"> </p>
<div class="table-responsive">
<table class="table table-striped">
<?php
if ($data=="atk") {
echo "<h3> Data ATK dan Stok </h3>";
//$atk = "SELECT nama_barang, stok FROM t_ATK";
$atk = "SELECT * FROM t_ATK";
$result = $conn->query($atk);
if ($result->num_rows > 0) {
echo "<tr>";
echo " <td>Kode Barang</td>";
echo " <td>Nama Barang</td>";
echo " <td>Stok (pcs)</td>";
echo "</tr>";
while($row = $result->fetch_assoc()) {
echo "<tr>";
echo " <td>" . $row["kode_barang"] . "</td>";
echo " <td>" . $row["nama_barang"] . "</td>";
echo " <td>" . $row["stok"] . "</td>";
echo "</tr>";
}
}
else {
echo "<p>Tidak ada hasil</p>";
}
}
else if ($data=="user") {
echo "<h3> Data Pengguna </h3>";
//$user= SELECT nama_user, kategori_user FROM t_user");
$user= "SELECT * FROM t_user";
$result = $conn->query($user);
if ($result->num_rows > 0) {
echo "<tr>";
echo " <td>ID User</td>";
echo " <td>Nama User</td>";
echo " <td>Kategori User</td>";
echo "</tr>";
while($row = $result->fetch_assoc()) {
echo "<tr>";
echo " <td>" . $row["id_user"] . "</td>";
echo " <td>" . $row["nama_user"] . "</td>";
echo " <td>" . $row["kategori_user"] . "</td>";
echo "</tr>";
}
}
else {
echo "<p>Tidak ada hasil</p>";
}
}
else if ($data=="usage") {
echo "<h3> Data Pemakaian </h3>";
$usage = "SELECT nama_barang, nama_user, n_pakai, deskripsi, tanggal FROM t_pemakaian ORDER BY nama_user ASC";
$result = $conn->query($usage);
if ($result->num_rows > 0) {
echo "<tr>";
echo " <td>Nama Barang</td>";
echo " <td>Pemakai</td>";
echo " <td>Jumlah Pakai (pcs)</td>";
echo " <td>Deskripsi</td>";
echo " <td>Tanggal</td>";
echo "</tr>";
while($row = $result->fetch_assoc()) {
echo "<tr>";
echo " <td>" . $row["nama_barang"] . "</td>";
echo " <td>" . $row["nama_user"] . "</td>";
echo " <td>" . $row["n_pakai"] . "</td>";
echo " <td>" . $row["deskripsi"] . "</td>";
echo " <td>" . $row["tanggal"] . "</td>";
echo "</tr>";
}
}
else {
echo "<p>Tidak ada hasil</p>";
}
}
?>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="row row-footer">
<div class ="col-xs-12 col-sm-4">
</div>
<div class ="col-xs-12 col-sm-4">
<p style="text-align:center;">Sistem Informasi ATK </p>
<p>Sarana dan Prasarana Institut Teknologi Bandung</p>
</div>
<div class ="col-xs-12 col-sm-4">
<p>Copyright 2016. Softspot Software House</p>
</div>
</div>
</div>
</body>
</html>