D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
u193541357
/
domains
/
racysanitaryware.com
/
public_html
/
dev
/
admin
/
Filename :
view-category.php
back
Copy
<?php include('header.php') ?> <div class="container-fluid"> <div class="d-sm-flex align-items-center justify-content-between mb-4"> <h1 class="h3 mb-2 text-gray-800">Categories</h1> <a href="add-category.php" class="btn btn-primary btn-icon-split"> <span class="text">Add Category</span> </a> </div> <div class="card shadow mb-4"> <div class="card-body"> <div class="table-responsive"> <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0"> <thead> <tr> <th>Sr. No</th> <th>Category Name</th> <th>Category Description</th> <th>Category Image</th> <th>Banner Image</th> <th>Action</th> </tr> </thead> <tfoot> <tr> <th>Sr. No</th> <th>Category Name</th> <th>Category Description</th> <th>Category Image</th> <th>Banner Image</th> <th>Action</th> </tr> </tfoot> <tbody> <?php $sql = "SELECT id, category_name, category_description, category_image, banner_image, status FROM categories"; $result = $conn->query($sql); if ($result->num_rows > 0) { $sr_no = 1; while ($row = $result->fetch_assoc()) { $checked = $row['status'] == 1 ? 'checked' : ''; // Check if status is active echo "<tr>"; echo "<td>" . $sr_no++ . "</td>"; echo "<td>" . $row['category_name'] . "</td>"; echo "<td>" . $row['category_description'] . "</td>"; echo "<td><img src='" . $row['category_image'] . "' alt='Category Image' style='max-width: 60px;'></td>"; echo "<td><img src='" . $row['banner_image'] . "' alt='Banner Image' style='max-width: 60px;'></td>"; echo "<td style='display:flex;align-items:center;'> <label class='switch'> <input type='checkbox' class='status-toggle-categories' data-id='" . $row['id'] . "' " . $checked . "> <span class='slider round'></span> </label> <a href='add-category.php?id=" . $row['id'] . "' class='btn btn-sm btn-danger ml-2'>Edit</a> </td>"; echo "</tr>"; } } else { echo "<tr><td colspan='5'>No categories found.</td></tr>"; } $conn->close(); ?> </tbody> </table> </div> </div> </div> </div> <?php include('footer.php') ?>