首页 > 解决方案 > 更新用户配置文件时如何解决此错误?

问题描述

我正在尝试创建用户更新配置文件页面,用户所做的一切都很好,更改存储在数据库中,但是当重定向到用户配置文件时,第 59 行出现错误。

这是我的代码。

控制器

function update_profile($id){
	$where = array('id' => $id);
	$data['tb_user'] = $this->Model_user->edit_data($where,'tb_user')->result();
	$this->load->view('user/user_eprofile',$data);
}

function save_profile(){
	$id = $this->input->post('id');
	$nama = $this->input->post('nama');
	$alamat = $this->input->post('alamat');
	$email = $this->input->post('email');
	$nohp = $this->input->post('nohp');



$data = array(


		'nama' => $nama,
		'alamat' => $alamat,
		'email'=>$email,
		 'nohp'=>$nohp,


);

$where = array(
	'id' => $id
);

$this->Model_user->update_data($where,$data,'tb_user');
 $this->session->set_flashdata('msg','<div class="alert alert-info"><i class="fas fa-info-circle"></i> Perubahan Tersimpan.</div>');
redirect('user/user_profile');
}

用户视图

<div class="logoarea pt-5 pb-5">
          <p>
            <center><img src="<?php echo base_url('assets/img/user.svg')?>" style="width:175px"></center>
          </p>

          <hr style="border-color:#ffffff;margin-top:30px;margin-bottom:30px">
          <h5 style="letter-spacing:3px"><b>PROFILE SAYA</b></h5>
          <?php echo $this->session->userdata('nama') ?>


          <br>
          <br>


---------- GOT ERROR ON THIS LINE AFTER SAVING USER DATA


          <a class="btn btn-outline-white btn-md btn-round" href="<?php echo site_url('user/user_profile/update_profile/'.$user->id);?>" style="font-size:12px;letter-spacing:2px"><i class="fas fa-user-edit" style="margin-right:10px"></i> UPDATE PROFILE</a>


----------


          <?php echo $this->session->flashdata('msg'); ?>
        </div>

标签: codeignitercodeigniter-3

解决方案


推荐阅读