1 つのボタン実行で 3 つのテーブルを更新しようとしましたが、なぜ t_user だけが変更されたのでしょうか? t_publisher と t_label は変更されず、エラー警告も表示されません..
function update($id_user=null){
if (($this->input->post('submit') == 'Update')){
$user=$this->input->post('username');
$pass=$this->input->post('userpassword');
$ussta=$this->input->post('userstatus');
$usty=$this->input->post('usertype');
$id_label = $this->db->query("select ID_LABEL from t_label where LABEL = '$name->USER_NAME'")->row();
$id_publisher = $this->db->query("select ID_PUBLISHER from t_publisher where PUBLISHER = '$name->USER_NAME'")->row();
$data = array(
'USER_NAME' => $user,
'USER_PASS' => $pass,
'USER_STATUS' => $ussta,
'USER_TYPE' => $usty
);
$data2 = array(
'LABEL' => $user,
);
$data3 = array(
'PUBLISHER' => $user,
);
$this->db->where('USER_ID', $this->input->post('id'));
$this->db->update('t_user', $data);
$this->db->where('ID_LABEL', $this->input->post('$id_label'));
$this->db->update('t_label', $data2);
$this->db->where('ID_PUBLISHER', $this->input->post('$id_publisher'));
$this->db->update('t_publisher', $data3);
redirect("registrasi/reg");
}
$var['data'] = $this->db->query("select * from t_user where USER_ID= '$id_user'")->row_array();
$this->load->view('update', $var);
}
助けてください :)