-
Notifications
You must be signed in to change notification settings - Fork 0
/
fetchUser.php
47 lines (32 loc) · 1.19 KB
/
fetchUser.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
<?php
require_once 'core.php';
$sql = "SELECT * FROM users";
$result = $connect->query($sql);
$output = array('data' => array());
if($result->num_rows > 0) {
// $row = $result->fetch_array();
$active = "";
while($row = $result->fetch_array()) {
$userid = $row[0];
// active
$username = $row[1];
$button = '<!-- Single button -->
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Action <span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a type="button" data-toggle="modal" id="editUserModalBtn" data-target="#editUserModal" onclick="editUser('.$userid.')"> <i class="glyphicon glyphicon-edit"></i> Edit</a></li>
<li><a type="button" data-toggle="modal" data-target="#removeUserModal" id="removeUserModalBtn" onclick="removeUser('.$userid.')"> <i class="glyphicon glyphicon-trash"></i> Remove</a></li>
</ul>
</div>';
$output['data'][] = array(
// name
$username,
// button
$button
);
} // /while
}// if num_rows
$connect->close();
echo json_encode($output);