prepare("UPDATE prices SET price = :price WHERE fuel_type = :fuel_type"); $stmt->execute(['price' => $petrol_price, 'fuel_type' => 'petrol']); $stmt->execute(['price' => $diesel_price, 'fuel_type' => 'diesel']); $success = 'Prices updated successfully!'; } catch (PDOException $e) { $error = 'Database error: ' . $e->getMessage(); } } // Fetch current prices and orders if admin is logged in $prices = []; $orders = []; if (isset($_SESSION['admin_logged_in']) && $_SESSION['admin_logged_in']) { require_once 'db/config.php'; try { $pdo = db(); // Fetch prices $stmt = $pdo->query("SELECT * FROM prices"); $all_prices = $stmt->fetchAll(); foreach ($all_prices as $p) { $prices[$p['fuel_type']] = $p['price']; } // Fetch orders $stmt = $pdo->query("SELECT * FROM orders ORDER BY order_date DESC"); $orders = $stmt->fetchAll(); } catch (PDOException $e) { $error = 'Database error: ' . $e->getMessage(); } } // Check for status update messages if (isset($_SESSION['update_success'])) { $success = $_SESSION['update_success']; unset($_SESSION['update_success']); } if (isset($_SESSION['update_error'])) { $error = $_SESSION['update_error']; unset($_SESSION['update_error']); } ?> Admin - Petrol Price Management

Admin Login

Update Fuel Prices

Order Management

Order ID Customer Fuel Type Quantity (L) Total Price Order Date Status Action
No orders found.
$