D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home3
/
encodto1
/
newpcjewellers.in
/
Filename :
products.php
back
Copy
<?php // Include your database connection file include('config.php'); include('header.php'); // Turn on error reporting for debugging ini_set('display_errors', 1); error_reporting(E_ALL); // Get the category ID and gender from the URL $category_id = isset($_GET['category']) ? intval($_GET['category']) : 0; $gender = isset($_GET['gender']) ? $_GET['gender'] : ''; // Prepare the query to fetch products by category and gender $query = " SELECT p.id, p.name, p.image1, p.purity, p.weight, p.gender, c.category_name FROM products p JOIN product_category c ON p.category = c.id WHERE c.id = ? "; // Add gender filtering to the query if the gender parameter is set if (!empty($gender)) { $query .= " AND p.gender = ?"; } // Prepare and execute the query if ($stmt = $conn->prepare($query)) { // Bind parameters depending on the presence of the gender filter if (!empty($gender)) { $stmt->bind_param("is", $category_id, $gender); } else { $stmt->bind_param("i", $category_id); } $stmt->execute(); // Store the result $result = $stmt->get_result(); } else { echo "Error preparing query: " . $conn->error; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>New PC Jewellers</title> <!-- Favicons --> <link rel="icon" type="image/png" sizes="32x32" href="images/favicon.png"> <meta name="msapplication-TileColor" content="#ffffff"> <meta name="theme-color" content="#ffffff"> <!-- Bootstrap and Other Vendors --> <link rel="stylesheet" href="css/bootstrap.min.css"> <link rel="stylesheet" href="css/bootstrap-theme.min.css"> <link rel="stylesheet" href="css/bootstrap-datepicker.min.css"> <link rel="stylesheet" href="css/jquery.fancybox.min.css" /> <link rel="stylesheet" href="css/jquery-ui.css"> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <link rel="stylesheet" href="css/fontawesome-all.min.css"> <link rel="stylesheet" href="vendors/owl.carousel/css/owl.carousel.min.css"> <link rel="stylesheet" type="text/css" href="vendors/flexslider/flexslider.css" media="screen" /> <!-- Fonts --> <link href="https://fonts.googleapis.com/css2?family=Domine:wght@400;500;600;700&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@300;400;500;600;700&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@300;400&display=swap" rel="stylesheet"> <!-- Styles --> <link rel="stylesheet" href="css/style.css"> <link rel="stylesheet" href="css/responsive.css"> <style> .product2 .imgHov img { width: 100%; height: 250px; object-fit: cover; } </style> </head> <body class="home-2"> <a href="#" id="back-to-top" title="Back to top">↑</a> <div class="innerLayout"> <section id="breadcrumbRow" class="row"> <h2>Products</h2> <div class="row pageTitle m0"> <div class="container"> <ul class="breadcrumb"> <li><a href="index.php">Home</a></li> <li class="active">Products</li> </ul> </div> </div> </section> <section class="row contentRowPad"> <div class="container"> <div class="row"> <?php if (isset($result) && $result->num_rows > 0) { while ($row = $result->fetch_assoc()) { ?> <div class="col-sm-3 product2"> <div class="row m0 thumbnail"> <div class="row m0 imgHov"> <img src="newadminpc/uploads/<?php echo htmlspecialchars($row['image1']); ?>" alt="<?php echo htmlspecialchars($row['name']); ?>"> <div class="hovArea row m0"> <div class="links row m0"> <a href="product-details.php?id=<?php echo htmlspecialchars($row['id']); ?>"><i class="fas fa-link"></i></a> <a class="lightbox" href="newadminpc/uploads/<?php echo htmlspecialchars($row['image1']); ?>" data-lightbox="product1" data-title="<?php echo htmlspecialchars($row['name']); ?>"><i class="fas fa-expand"></i></a> </div> </div> </div> <div class="row m0 productIntro"> <h5 class="heading"><a href="product-details.php?id=<?php echo htmlspecialchars($row['id']); ?>"><?php echo htmlspecialchars($row['name']); ?></a></h5> <ul class="list-inline jewelBox"> <li>Purity: <span><?php echo htmlspecialchars($row['purity']); ?></span></li> <li>Weight: <span><?php echo htmlspecialchars($row['weight']); ?></span></li> </ul> <a class="jewelAnchor" href="product-details.php?id=<?php echo htmlspecialchars($row['id']); ?>">Explore Details <i class="fas fa-angle-right"></i></a> </div> </div> </div> <?php } } else { echo "<p>No products found in this category and gender.</p>"; } ?> </div> </div> </section> <!-- Social Section --> <section class="social_sec"> <div class="social_div"> <ul class="sociallist"> <li><a href="https://www.facebook.com/newpcjewellersslg01"> <img src="images/icons/facebook.png" alt="social-icon"> </a></li> <li><a href="https://www.instagram.com/newpcjewellerssiliguri/"> <img src="images/icons/instagram.png" alt="social-icon"> </a></li> </ul> </div> <div class="whatsapp_Div"> <a class="video-vemo-icon" href="https://api.whatsapp.com/send/?phone=919734355000"><img src="images/icons/whatsapp.png"></a> </div> </section> <!-- Footer Section --> <?php require('footer.php') ?> </div> <!-- JS Scripts --> <script src="js/jquery.min.js"></script> <script src="js/bootstrap.min.js"></script> <script src="js/bootstrap-datepicker.min.js"></script> <script src="js/jquery.fancybox.min.js"></script> <script src="js/jquery-ui.js"></script> <script src="vendors/owl.carousel/js/owl.carousel.min.js"></script> <script src="vendors/flexslider/jquery.flexslider-min.js"></script> <script src="js/main.js"></script> </body> </html>