:: **Zploit** v1.0 | Current Path: **/home/kreativepixelz/www/crm/quatation/**
:: Editing File: products_list.php
<?php ob_start(); // ✅ ADD THIS LINE FIRST error_reporting(E_ALL); ini_set('display_errors', 1); include_once("session.php"); include("header.php"); include("db.php"); ?> <link href="assets/vendor/datatable/jquery.dataTables.min.css" rel="stylesheet"> <main> <div class="container-fluid"> <!-- PAGE HEADER --> <div class="row m-1"> <div class="col-9"> <h4 class="main-title">Product List</h4> <ul class="app-line-breadcrumbs mb-3"> <li> <a href="dashboard.php"> <i class="ph-duotone ph-bank"></i> Home </a> </li> <li class="active">Product</li> </ul> </div> <div class="col-3 text-end"> <a href="products_add.php" class="btn btn-primary"> + Add Product </a> </div> </div> <!-- TABLE --> <div class="card"> <div class="card-body p-0"> <div class="app-datatable-default overflow-auto"> <table class="display app-data-table" id="productTable"> <thead> <tr> <th>No</th> <!--<th>Category</th>--> <th>Product Name</th> <!--<th>Quantity</th>--> <th>Unit</th> <th>Status</th> <th width="120">Action</th> </tr> </thead> <tbody> <?php $no = 1; $sql = " SELECT pm.id, pm.product_name, pm.quantity, pm.unit_type, pm.status, mc.category_name FROM packaging_materials pm INNER JOIN material_categories mc ON mc.id = pm.category_id WHERE pm.category_id = '1' ORDER BY pm.id asc "; $result = mysqli_query($conn, $sql); if ($result && mysqli_num_rows($result) > 0) { while ($row = mysqli_fetch_assoc($result)) { $status = ($row['status'] == 1) ? '<span class="badge bg-success">Active</span>' : '<span class="badge bg-danger">Inactive</span>'; ?> <tr> <td><?= $no++; ?></td> <!--<td><?php /* htmlspecialchars($row['category_name']);*/ ?></td>--> <td><?= htmlspecialchars($row['product_name']); ?></td> <!--<td><?php /* number_format($row['quantity'], 3); */ ?></td>--> <td><?= $row['unit_type']; ?></td> <td><?= $status; ?></td> <td> <a href="products_edit.php?id=<?= $row['id']; ?>" class="btn btn-light-success btn-sm"> <i class="ti ti-edit"></i> </a> <a href="products_delete.php?id=<?= $row['id']; ?>" onclick="return confirm('Delete this product?');" class="btn btn-light-danger btn-sm"> <i class="ti ti-trash"></i> </a> </td> </tr> <?php } } else { echo "<tr><td colspan='7' class='text-center'>No products found</td></tr>"; } ?> </tbody> </table> </div> </div> </div> </div> </main> <?php include("footer.php"); ?> <script src="assets/vendor/datatable/jquery-3.5.1.js"></script> <script src="assets/vendor/datatable/jquery.dataTables.min.js"></script> <script> $(function () { $('#productTable').DataTable({ ordering: false, pageLength: 10 }); }); </script> <?php ob_end_flush(); ?>