MySQL更新数据库,其中后置值在数组中

I have a site where users can input multiple values in the text fields, so I created an array for the post values and have successfully inserted the values of the array into the database.

I have a problem updating these values that I have stored in the database. I tried this but it's not working.

<?php
if (!empty($_POST['sub_cat'])) {
    $cat_id = $_GET['c_id'];
    $subcat_title_array = $_POST['sub_cat'];
    for ($i = 0; $i < count($subcat_title_array); $i++) {
        $subcat_title = mysqli_real_escape_string($connection, $subcat_title_array[$i]);
        $query = "UPDATE sub_categories SET subcat_title =  '{$subcat_title}' WHERE subcat_id = $cat_id";
        $update_sub_category = mysqli_query($connection, $query);
        if (!$update_sub_category) {
            die("Query Failed " . mysqli_error($connection));
        }
    }          
} 
?>

Is there anything am doing wrong?

Any help will be appreciated.