<?php include('../config.php');

if($_SERVER['REQUEST_METHOD'] == 'POST'){
    $left_digit_1 = mysqli_real_escape_string($con,$_POST['left_digit_1']);
    $left_digit_2 = mysqli_real_escape_string($con,$_POST['left_digit_2']);
    $right_digit_1 = mysqli_real_escape_string($con,$_POST['right_digit_1']);
    $right_digit_2 = mysqli_real_escape_string($con,$_POST['right_digit_2']);
    $jodi_digit_1 = mysqli_real_escape_string($con,$_POST['jodi_digit_1']);
    $jodi_digit_2 = mysqli_real_escape_string($con,$_POST['jodi_digit_2']);
    
    $update_left_digit = mysqli_query($con,"UPDATE `gali_desawar_game_rates` SET `min_value`='$left_digit_1',`max_value`='$left_digit_2' WHERE type = 'Left Digit'");
    $update_right_digit = mysqli_query($con,"UPDATE `gali_desawar_game_rates` SET `min_value`='$right_digit_1',`max_value`='$right_digit_2' WHERE type = 'Right Digit'");
    $update_jodi_digit = mysqli_query($con,"UPDATE `gali_desawar_game_rates` SET `min_value`='$jodi_digit_1',`max_value`='$jodi_digit_2' WHERE type = 'Jodi Digit'");
    if($update_jodi_digit){
        ?>
        <script>alert('Details Updated Successfully!!');
        window.location = '../gali-desawar-game-rates.php';</script>
        <?php
    }else{
        ?>
        <script>alert('Some Error Occured! Try Again Later!!');
        window.location = '../gali-desawar-game-rates.php';</script>
        <?php
    }
}
?>