%PDF- %GIF98; %PNG;
Server : ApacheSystem : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64 User : ndkhermy ( 1200) PHP Version : 8.5.12 Disable Function : NONE Directory : /home1/ndkhermy/www/website_93b53270/ |
Upload File : |
<?php
include('function.php');
if(isset($_POST['cat_id'])) {
// Sanitize the input to prevent SQL injection
$cat_id = mysqli_real_escape_string($conn, $_POST['cat_id']);
$querys = mysqli_query($conn,"SELECT * FROM car_brands_tbl WHERE id='$cat_id'");
$results=mysqli_fetch_assoc($querys);
$cat_name =$results['name'];
$query = "SELECT * FROM product_tbl WHERE cat_id=$cat_id";
$result = mysqli_query($conn, $query);
if($result) {
// Fetch and display the products
if(mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_assoc($result)) {
// Display product information as desired
echo' <div class="listing">
<h6 class="fs-16">'.$cat_name .'</h6>
<div class="listing-flex">
<div>
<img src="'.$base_url.'images/Upload/product/'.$row['image1'].'" class="me-4">
</div>
<div >
'.$row['short_description'].'
</div>
</div>
<div class="rating-cart-flex">
<div>
<p class="mb-0"><span class="badge-red"><img src="img/rating-white-star.svg" class="img-fluid"> 4.9</span> Expert Rating</p>
</div>
<div class="merge-cart">
<span>AED'.$row['price'].'</span>
<a class="white-cart" href="#"><i class="bi bi-plus"></i> Add to Cart</a>
</div>
</div>
</div>';
}
} else {
// If no products found for the selected categories
echo '<p>No products found for the selected category.</p>';
}
} else {
// If query execution failed
echo '<p>Error executing query: ' . mysqli_error($conn) . '</p>';
}
// Close the database connection
mysqli_close($conn);
} else {
// If 'cat_id' parameter is not set
echo '<p>No category ID provided.</p>';
}
?>