prepare("SELECT * FROM `category` WHERE slug = :slug"); $stmt->execute(['slug' => $slug]); $data = $stmt->fetch(PDO::FETCH_ASSOC); if ($data) { $cateId = $data['id']; $cateName = $data['name']; } } catch (PDOException $e) { // Handle potential database errors gracefully error_log("Database error: " . $e->getMessage()); header("Location: $base_url/404.htm"); exit; } } else { // 'slug' not set — redirect to 404 header("Location: $base_url/404.htm"); exit; } ?>
Product Categories
    prepare("SELECT * FROM `category` WHERE `id` != 1"); $categoryStmt->execute(); $categories = $categoryStmt->fetchAll(); foreach ($categories as $category) { ?>

Wholesaler and Retailer in

prepare("SELECT * FROM `service` WHERE cate = :cateid"); $proStmt->bindValue(':cateid', $cateId, PDO::PARAM_INT); $proStmt->execute(); $rowCount = $proStmt->rowCount(); if ($rowCount > 0): // Fetch rows $products = $proStmt->fetchAll(); foreach ($products as $product): ?>
    1): ?>