更新用戶的詳細信息時,數據庫將更新所有信息,但當頁面刷新時,先前的信息將顯示,並且不更新,除非用戶已註銷並重新登錄。 CodeIgniter的新成員。有人可以幫助我或告訴我該怎麼做,我真的很感激。提前致謝。正在更新 - codeigniter php
這是我的模型:
function updateAccount($submit_userid, $submit_phone, $submit_address, $submit_eaddress) {
$this->db->where("intMemberID", $submit_userid);
$this->db->update("tblMembers", array(
"strPhoneNumber" => $submit_phone,
"strMemberAddress" => $submit_address,
"strEmailAddress" => $submit_eaddress,
));
}
這是我的控制器:
class UpdateController extends CI_Controller {
public function updateAccount() {
$this->load->model('userModel');
$data['userdata'] = $this->session->userdata('userobject');
$submit_userid = $this->input->post('userid');
$submit_phone = $this->input->post('phone');
$submit_address = $this->input->post('address');
$submit_eaddress = $this->input->post('eaddress');
$this->userModel->updateAccount($submit_userid, $submit_phone, $submit_address, $submit_eaddress);
$this->load->view('updateView', $data);
}
}
什麼是'$ this-> session-> userdata('userobject')'和它在哪裏填充? –
在更新之前檢索發送到視圖的數據,嘗試在更新後獲取userdata –