<?php
include('include/db.php'); // Adjust based on your setup
include('loginCheck.php');

if (isset($_POST['updateFarming'])) {
    $roiPercent = floatval($_POST['roiPercent']);
    $packageId = floatval($_POST['packageId']);

    $updateQuery = "UPDATE meddolic_config_package_type SET roiPercent = '$roiPercent' where packageId = '$packageId'";
    if (mysqli_query($con, $updateQuery)) {
        header("Location: farmingSetting.php?status=success");
    } else {
        echo "Error updating record: " . mysqli_error($con);
    }
} else {
    header("Location: farmingSetting.php");
}
?>
