-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtabelpH.php
329 lines (307 loc) · 15.7 KB
/
tabelpH.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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
<?php
include 'koneksi.php';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$pH = $_POST['pH'];
$sql = "INSERT INTO tb_ph (pH, created_at) VALUES ('$pH', NOW())";
if ($konek->query($sql) === TRUE) {
echo "Record inserted successfully";
} else {
echo "Error: " . $sql . "<br>" . $konek->error;
}
$konek->close();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title> SIMBIOTIK </title>
<meta content='width=device-width, initial-scale=1.0, shrink-to-fit=no' name='viewport' />
<link rel="icon" href="assets/img/icon.ico" type="image/x-icon" />
<!-- Fonts and icons -->
<script src="assets/js/plugin/webfont/webfont.min.js"></script>
<script>
WebFont.load({
google: {
"families": ["Open+Sans:300,400,600,700"]
},
custom: {
"families": ["Flaticon", "Font Awesome 5 Solid", "Font Awesome 5 Regular", "Font Awesome 5 Brands"],
urls: ['assets/css/fonts.css']
},
active: function() {
sessionStorage.fonts = true;
}
});
</script>
<!-- CSS Files -->
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/azzara.min.css">
<!-- CSS Just for demo purpose, don't include it in your project -->
<link rel="stylesheet" href="assets/css/demo.css">
</head>
<body>
<div class="wrapper">
<div class="main-header" style="background-color: #294A79;">
<div class="logo-header">
<a href="index.html" class="logo">
<div style="font-weight: bold;" alt="navbar brand" class="navbar-brand text-white">SIMBIOTIK</div>
</a>
<button class="navbar-toggler sidenav-toggler ml-auto" type="button" data-toggle="collapse"
data-target="collapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon">
<i class="fa fa-bars"></i>
</span>
</button>
<button class="topbar-toggler more"><i class="fa fa-ellipsis-v"></i></button>
<div class="navbar-minimize">
<button class="btn btn-minimize btn-rounded">
<i class="fa fa-bars"></i>
</button>
</div>
</div>
<nav class="navbar navbar-header navbar-expand-lg">
<div class="container-fluid">
<ul class="navbar-nav topbar-nav ml-md-auto align-items-center">
<li class="nav-item toggle-nav-search hidden-caret">
<a class="nav-link" data-toggle="collapse" href="#search-nav" role="button"
aria-expanded="false" aria-controls="search-nav">
<i class="fa fa-search"></i>
</a>
</li>
<li class="nav-item dropdown hidden-caret">
<a class="nav-link dropdown-toggle" href="#" id="notifDropdown" role="button"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-bell"></i>
<span class="notification">3</span>
</a>
<ul class="dropdown-menu notif-box animated fadeIn" aria-labelledby="notifDropdown">
<li>
<div class="dropdown-title">You have 3 new notification</div>
</li>
<li>
<div class="notif-center">
<a href="#">
<div class="notif-icon notif-primary"></div>
<div class="notif-content">
<span class="block">pH Air saat ini 30c</span>
<span class="time">5 minutes ago</span>
</div>
</a>
<a href="#">
<div class="notif-icon notif-success"></div>
<div class="notif-content">
<span class="block">Air mencapai batas maksimum</span>
<span class="time">12 minutes ago</span>
</div>
</a>
<a href="#">
<div class="notif-icon notif-danger"></div>
<div class="notif-content">
<span class="block">Tanaman membutuhkan TDS</span>
<span class="time">17 minutes ago</span>
</div>
</a>
</div>
</li>
</ul>
</li>
<li class="nav-item dropdown hidden-caret">
<a class="dropdown-toggle profile-pic" data-toggle="dropdown" href="#"
aria-expanded="false">
<div class="avatar-sm">
<img src="assets/img/paklinds2.jpg" alt="..." class="avatar-img rounded-circle">
</div>
</a>
<ul class="dropdown-menu dropdown-user animated fadeIn">
<li>
<div class="user-box">
<div class="avatar-lg"><img src="assets/img/paklinds2.jpg" alt="image profile"
class="avatar-img rounded"></div>
<div class="u-text">
<h4>Lindung Siswanto</h4>
<p class="text-muted">Admin</p>
</div>
</div>
</li>
<li>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="profile.php">My Profile</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="accsetting.php">Account Setting</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#" data-toggle="modal"
data-target="#logoutModal">Logout</a>
</li>
</ul>
</li>
</ul>
</div>
</nav>
</div>
<div class="sidebar">
<div class="sidebar-background" style="background-color: #c1c1c1;"></div>
<div class="sidebar-wrapper scrollbar-inner">
<div class="sidebar-content">
<ul class="nav">
<li class="nav-item">
<a href="dashboard.php">
<i class="fas fa-fw fa-tachometer-alt"></i>
<p>Dashboard</p>
</a>
</li>
<hr>
<li class="nav-item">
<a href="control.php">
<i class="fas fa-fw fa-cog"></i>
<p>Control</p>
</a>
</li>
<li class="nav-item">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#logoutModal">
<i class="fas fa-sign-out-alt"></i>
<p>Logout</p>
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="main-panel">
<div class="content">
<div class="page-inner">
<div class="page-header">
<h4 class="page-title">Tabel Data Sensor pH</h4>
<ul class="breadcrumbs">
<li class="nav-home">
<a href="dashboard.php">
<i class="flaticon-home"></i>
</a>
</li>
<li class="separator">
<i class="flaticon-right-arrow"></i>
</li>
</ul>
</div>
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header">
<h4 class="card-title">Tabel Data Sensor pH</h4>
</div>
<div class="card-body">
<div class="table-responsive">
<table id="basic-datatables" class="display table table-striped table-hover">
<thead>
<tr>
<th>Nilai pH Air</th>
<th>Waktu</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Nilai pH Air</th>
<th>Waktu</th>
</tr>
</tfoot>
<tbody>
<?php
include 'koneksi.php';
$sql = "SELECT pH,created_at FROM tb_ph";
$result = $konek->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo "<tr>
<td>" . $row["pH"]. "</td>
<td>" . $row["created_at"]. "</td>
</tr>";
}
} else {
echo "<tr><td colspan='6'>No data available</td></tr>";
}
$konek->close();
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="logoutModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Ready to Leave?</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">Select "Logout" below if you are ready to end your current session.</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="index.php">Logout</a>
</div>
</div>
</div>
</div>
</div>
<script src="assets/js/core/jquery.3.2.1.min.js"></script>
<script src="assets/js/core/popper.min.js"></script>
<script src="assets/js/core/bootstrap.min.js"></script>
<script src="assets/js/plugin/jquery-ui-1.12.1.custom/jquery-ui.min.js"></script>
<script src="assets/js/plugin/jquery-ui-touch-punch/jquery.ui.touch-punch.min.js"></script>
<script src="assets/js/plugin/bootstrap-toggle/bootstrap-toggle.min.js"></script>
<script src="assets/js/plugin/jquery-scrollbar/jquery.scrollbar.min.js"></script>
<script src="assets/js/plugin/datatables/datatables.min.js"></script>
<script src="assets/js/ready.min.js"></script>
<script src="assets/js/setting-demo.js"></script>
<script>
$(document).ready(function() {
$('#basic-datatables').DataTable({});
$('#multi-filter-select').DataTable({
"pageLength": 5,
initComplete: function() {
this.api().columns().every(function() {
var column = this;
var select = $(
'<select class="form-control"><option value=""></option></select>'
)
.appendTo($(column.footer()).empty())
.on('change', function() {
var val = $.fn.dataTable.util.escapeRegex(
$(this).val()
);
column
.search(val ? '^' + val + '$' : '', true, false)
.draw();
});
column.data().unique().sort().each(function(d, j) {
select.append('<option value="' + d + '">' + d +
'</option>')
});
});
}
});
$('#add-row').DataTable({
"pageLength": 5,
});
var action =
'<td> <div class="form-button-action"> <button type="button" data-toggle="tooltip" title="" class="btn btn-link btn-primary btn-lg" data-original-title="Edit Task"> <i class="fa fa-edit"></i> </button> <button type="button" data-toggle="tooltip" title="" class="btn btn-link btn-danger" data-original-title="Remove"> <i class="fa fa-times"></i> </button> </div> </td>';
$('#addRowButton').click(function() {
$('#add-row').dataTable().fnAddData([
$("#addName").val(),
$("#addPosition").val(),
$("#addOffice").val(),
action
]);
$('#addRowModal').modal('hide');
});
});
</script>
</body>
</html>