D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
u193541357
/
domains
/
racysanitaryware.com
/
public_html
/
admin
/
Filename :
view-product(1).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">Products</h1> <a href="add-product.php" class="btn btn-primary btn-icon-split"> <span class="text">Add Product</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</th> <th>Product Name</th> <!-- <th>Code 1</th> <th>Description 1</th> <th>Code 2</th> <th>Description 2</th> <th>Code 3</th> <th>Description 3</th> --> <th>Product Image</th> <th>Product Drawing</th> <th>Action</th> </tr> </thead> <tfoot> <tr> <th>Sr. No</th> <th>Category</th> <th>Product Name</th> <!-- <th>Code 1</th> <th>Description 1</th> <th>Code 2</th> <th>Description 2</th> <th>Code 3</th> <th>Description 3</th> --> <th>Product Image</th> <th>Product Drawing</th> <th>Action</th> </tr> </tfoot> <tbody> <?php $sql = "SELECT products.id, products.product_name, products.product_codeno1, products.product_desc1, products.product_codeno2, products.product_desc2, products.product_codeno3, products.product_desc3, products.product_image, products.product_drawing, categories.category_name, products.status FROM products JOIN categories ON products.category_id = categories.id"; $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['product_name'] . "</td>"; // echo "<td>" . $row['product_codeno1'] . "</td>"; // echo "<td>" . $row['product_desc1'] . "</td>"; // echo "<td>" . $row['product_codeno2'] . "</td>"; // echo "<td>" . $row['product_desc2'] . "</td>"; // echo "<td>" . $row['product_codeno3'] . "</td>"; // echo "<td>" . $row['product_desc3'] . "</td>"; echo "<td><img src='" . $row['product_image'] . "' alt='Product Image' style='max-width: 60px;'></td>"; echo "<td><img src='" . $row['product_drawing'] . "' alt='Product Drawing' style='max-width: 60px;'></td>"; echo "<td style='display:flex;align-items:center;'> <label class='switch'> <input type='checkbox' class='status-toggle-products' data-id='" . $row['id'] . "' " . $checked . "> <span class='slider round'></span> </label> <a href='add-product.php?id=" . $row['id'] . "' class='btn btn-sm btn-danger ml-2'>Edit</a> </td>"; echo "</tr>"; } } else { echo "<tr><td colspan='12'>No products found.</td></tr>"; } $conn->close(); ?> </tbody> </table> </div> </div> </div> </div> <?php include('footer.php'); ?>