SQL更新codeigniter错误不会更新

I need to update the database but it is not updating. it does not appear error or update when I put the variable $ user_id it from several errors.

public function is_accepted($user_id){
    $this->db->set('is_accepted', '1');
    $this->db->where('user_id', $user_id);
    $this->db->update('users');

    //UPDATE `users` SET `is_accepted` = '1' WHERE `users`.`user_id` = 1;
}

MODEL:

public function get_user_id_from_username($username) {
    $this->db->select('user_id');
    $this->db->from('users');
    $this->db->where('username', $username);

    return $this->db->get()->row('user_id');

}

public function get_user($user_id) {

    $this->db->from('users');
    $this->db->where('user_id', $user_id);
    return $this->db->get()->row();

}

private function hash_password($password) {

    return password_hash($password, PASSWORD_BCRYPT);

}

private function verify_password_hash($password, $hash) {

    return password_verify($password, $hash);

}

CONTROLLER:

public function saveUpdate(){
    $this->user_model->is_accepted();
    //redirect('/painel');
}

VIEW: this load view not update

<?php if(($_SESSION['is_accepted']) == false): ?>
    <div class="row" style="margin-top: 40px;margin-bottom: 40px">    
        <div class="form-horizontal">
            <div class="col-sm-4 col-sm-offset-5">
                <button class="btn btn-primary" onclick="window.location='<?php echo base_url('saveUpdate'); ?>'">Aceitar contrato</button>
            </div>
        </div>
    </div>
<?php  endif;?>

I think you are missing $user_id in Controller

public function saveUpdate(){
     $this->user_model->is_accepted($user_id);
    //redirect('/painel');
}

One one more thing What is the datatype for is_accepted ? is it varchar or int ? send according to that.

missing param for your model when calling from your function

Controller

//passed in as a param
public function saveUpdate($user_id){
  //need to get user_id to pass in to model
  $this->user_model->is_accepted($user_id);

}

also clean up you code some

Model

public function is_accepted($user_id){

  $this->db->where('user_id', $user_id)->update('users', ['is_accepted'=>1]);

}

View

Change your button to an anchor tag

 <a class="btn btn-primary" href="<?php echo base_url('saveUpdate/'.$user_id); ?>">Aceitar contrato</a>