// Get the correct config path $config_path = isset($_REQUEST['_root_path']) ? $_REQUEST['_root_path'] . '/config/config.php' : __DIR__ . '/../config/config.php'; require_once $config_path; // Helper function to get image URL function getImageUrl($stored_path) { global $_REQUEST; $root = isset($_REQUEST['_root_path']) ? $_REQUEST['_root_path'] : __DIR__ . '/..'; // Remove ../ if present $clean_path = str_replace('../', '', $stored_path); $full_path = $root . '/' . $clean_path; // Check if file exists if (file_exists($full_path)) { return '/' . $clean_path; } return ''; } $conn = null; $best_sellers = []; $error_msg = ''; try { $conn = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME); if ($conn->connect_error) { $error_msg = "Database Connection Error"; } else { $conn->set_charset("utf8"); // Get best sellers (limit 4) $result = $conn->query("SELECT id, name, price, image_url FROM products LIMIT 4"); if ($result) { while ($row = $result->fetch_assoc()) { $best_sellers[] = $row; } } } } catch (Exception $e) { $error_msg = "Error: " . $e->getMessage(); } ?>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.
Shop NowFeatured Product Images
Will Display Here
No products available yet. Check back soon!
Get your product + a sample
Phasellus ullamcorper premium vehicula. Donec scelerisque, mi dictum suscipit laboris, ornare tortor doctor urna, nec ornare leo mauris sed nibh.
Shop Now