-
Notifications
You must be signed in to change notification settings - Fork 148
/
Copy pathfetchBrand.php
48 lines (37 loc) · 1.43 KB
/
fetchBrand.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
<?php
require_once 'core.php';
$sql = "SELECT brand_id, brand_name, brand_active, brand_status FROM brands WHERE brand_status = 1";
$result = $connect->query($sql);
$output = array('data' => array());
if($result->num_rows > 0) {
// $row = $result->fetch_array();
$activeBrands = "";
while($row = $result->fetch_array()) {
$brandId = $row[0];
// active
if($row[2] == 1) {
// activate member
$activeBrands = "<label class='label label-success'>Available</label>";
} else {
// deactivate member
$activeBrands = "<label class='label label-danger'>Not Available</label>";
}
$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" data-target="#editBrandModel" onclick="editBrands('.$brandId.')"> <i class="glyphicon glyphicon-edit"></i> Edit</a></li>
<li><a type="button" data-toggle="modal" data-target="#removeMemberModal" onclick="removeBrands('.$brandId.')"> <i class="glyphicon glyphicon-trash"></i> Remove</a></li>
</ul>
</div>';
$output['data'][] = array(
$row[1],
$activeBrands,
$button
);
} // /while
} // if num_rows
$connect->close();
echo json_encode($output);