prepare("INSERT INTO fuel_types (name) VALUES (?)");
$stmt->execute([$name]);
$message = '
Fuel type added successfully!
';
} catch (PDOException $e) {
if ($e->errorInfo[1] == 1062) { // Duplicate entry
$message = 'Error: A fuel type with this name already exists.
';
} else {
$message = 'Error: ' . $e->getMessage() . '
';
}
}
} else {
$message = 'Please enter a fuel type name.
';
}
}
// Fetch all fuel types to display
$stmt = $pdo->query("SELECT * FROM fuel_types ORDER BY name");
$fuel_types = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>
Manage Fuel Types
List of all fuel types available in the system (e.g., MS, HSD, Power).
| Fuel Type Name |
Actions |
| No fuel types found. Add one to get started. |
|
Edit
Delete
|