���� JFIF fdasasfas213sdaf
Server IP : 88.222.243.122 / Your IP : 216.73.216.200 Web Server : LiteSpeed System : Linux in-mum-web669.main-hosting.eu 5.14.0-503.23.2.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Feb 12 05:52:18 EST 2025 x86_64 User : u479334040 ( 479334040) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/u479334040/domains/rfconnector.info/public_html/ |
Upload File : |
<?php include('includes/config.php'); function getCategories($con) { $query = "SELECT * FROM category WHERE parent_id = 0"; // Fetch parent categories $result = mysqli_query($con, $query); if (!$result) { die("Category Query Failed: " . mysqli_error($con)); } return $result; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Categories</title> <style> .category { padding: 10px; margin: 10px; border: 1px solid #ddd; display: block; text-decoration: none; color: black; width: 200px; display: flex; align-items: center; } .category img { width: 50px; height: 50px; margin-right: 10px; object-fit: cover; } </style> </head> <body> <h2>Categories</h2> <?php $categories = getCategories($con); while ($cat = mysqli_fetch_assoc($categories)) { // Prepare the image path if there is an image associated with the category $imagePath = 'product-admin/uploads/category/' . $cat['categoryImage']; // Check if the image exists if (file_exists($imagePath) && !empty($cat['categoryImage'])) { $imageHtml = "<img src='$imagePath' alt='" . $cat['categoryName'] . "' />"; } else { $imageHtml = "<img src='default-image.jpg' alt='No Image' />"; // Default image in case there's no category image } // Output the category with image echo "<a href='subcategories.php?parent_id=" . $cat['id'] . "' class='category'>" . $imageHtml . $cat['categoryName'] . "</a>"; } ?> </body> </html>