<?php
include '../includes/config.php';

// print_r($_POST);

if (isset($_POST['update-starline'])) { 
    $starline_game_name = $_POST['starline_game_name']; 
    // $starline_game_time = $_POST['starline_game_time'];
    
    $starline_game_time = date('H:i:s' , strtotime($_POST['starline_game_time']));
    
    $starline_id = $_POST['starline_id'];
    
    $gametype = $_POST['gametype'];
    
    $sql = "UPDATE `starLineMarketList` SET `star_name`='$starline_game_name' , market_time = '$starline_game_time' WHERE id ='$starline_id'";
    
    if($gametype == "starline_market"){
        if(!mysqli_query($conn,$sql)) {
            echo '<script>alert("Starline Update Failed");window.location = "../starline-game-name.php";</script>';
        }else{
            echo '<script>alert("Starline Update Successfully");window.location = "../starline-game-name.php";</script>';
        }
    }elseif($gametype == "starline_market_one"){
        if(!mysqli_query($conn,$sql)) {
            echo '<script>alert("Kolkata FF Update Failed");window.location = "../kolkataff-game-name.php";</script>';
        }else{
            echo '<script>alert("Kolkata FF Update Successfully");window.location = "../kolkataff-game-name.php";</script>';
        }
    }elseif($gametype == "starline_market_two"){
        if(!mysqli_query($conn,$sql)) {
            echo '<script>alert("Mumbai FF Update Failed");window.location = "../mumbaiff-game-name.php";</script>';
        }else{
            echo '<script>alert("Mumbai FF Update Successfully");window.location = "../mumbaiff-game-name.php";</script>';
        }
    }
    
}

?>