prepare("UPDATE inventory SET quantity = ? WHERE product_id = ?"); $stmt->execute([$quantity, $product_id]); $_SESSION['success_message'] = "Inventory updated successfully!"; } catch (PDOException $e) { error_log("Inventory update failed: " . $e->getMessage()); $_SESSION['error_message'] = "Failed to update inventory. Please try again."; } header('Location: /dashboard.php?page=admin_inventory'); exit;