/
var
/
www
/
html
/
stengineers
/
admin
/
Upload FileeE
HOME
<?php header('Access-Control-Allow-Origin: *'); require_once 'dbconnection.php'; $brmenu_active = "active"; include 'header.php'; ?> <!-- Begin Page Content --> <div class="container-fluid"> <!-- Page Heading --> <h1 class="h3 mb-2 text-gray-800">Brand List</h1> <p> <a href="brand-add.php" class="btn btn-success btn-icon-split"> <span class="icon text-white-50"> <i class="fas fa-check"></i> </span> <span class="text">Add Brand</span> </a> </p> <!-- DataTales Example --> <div class="card shadow mb-4"> <div class="card-header py-3"> <!-- <h6 class="m-0 font-weight-bold text-primary">DataTables Example</h6> --> </div> <div class="card-body"> <div class="table-responsive"> <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0"> <thead> <tr> <th>brand</th> <th>Image</th> <th>Status</th> <th>Action</th> </tr> </thead> <!-- <tfoot> <tr> <th>Title</th> <th>Image</th> <th>Created at</th> <th>Total Comments</th> <th>Status</th> <th>Approved</th> <th>Action</th> </tr> </tfoot> --> <tbody id="table_id"> <?php $s = "select * from brand"; $res = mysqli_query($con, $s); $num = mysqli_num_rows($res); if ($num == 0) { echo '<tr> <td colspan="6">No Datas Found</td> </tr>'; } else { $sql = "SELECT id,brandname,brandlogo,status FROM brand ORDER BY id DESC"; $selected = mysqli_query($con, $sql); $carr = array(); // Define the variable before using it while ($row = mysqli_fetch_assoc($selected)) { $carr[] = $row; } for ($i = 0; $i < count($carr); $i++) { $id = $carr[$i]['id']; $brandname = $carr[$i]['brandname']; $image = $carr[$i]['brandlogo']; $bstatus = $carr[$i]['status']; echo "<tr> <td>$brandname</td> <td><img src='$image' style='width:100px' /></td> <td>$bstatus</td> <td style='white-space: nowrap;'> <a href='brand-edit.php?id=$id' class='btn btn-info btn-circle btn-sm'> <i class='fas fa-edit'></i> </a> <a class='btn btn-danger btn-circle btn-sm' onclick='deleteData($id)'> <i class='fas fa-trash'></i> </a> </td> </tr>"; } } ?> </tbody> </table> </div> </div> </div> </div> <!-- /.container-fluid --> <script type="text/javascript"> function refreshData(){ $("#table_id").load(window.location + " #table_id"); } function deleteData(id){ var id = id; var getData; if(confirm('Are you sure you want to delete?')) { $.ajax({ url: 'api/brand.php', type: 'POST', data:{id:id,action:"deletebrand", referer:"ezioaws"}, success: function (response) { var data = JSON.parse(response); console.log(data); if (data.status == 'success') { alert("Deleted Successfully") window.location.href="brands.php"; } else { alert("Failed, Please try again later") } } }); } } </script> <?php include 'footer.php'?>