Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function create_action()
- {
- $this->_rules();
- if ($this->form_validation->run() == FALSE) {
- $this->create();
- }
- else {
- $user=$this->ion_auth->user()->row();
- $data = array(
- 'nama' => $this->input->post('nama',TRUE),
- 'npm' => $this->input->post('npm',TRUE),
- 'fakultas' => $this->input->post('fakultas',TRUE),
- 'jurusan' => $this->input->post('jurusan',TRUE),
- 'semester' => $this->input->post('semester',TRUE),
- 'kamar' => $this->input->post('kamar',TRUE),
- //'operator' => $this->input->post('operator',TRUE),
- 'operator' =>$user->first_name.' '.$user->last_name,
- 'noHP' => $this->input->post('noHP',TRUE),
- );
- $ambil_id_mhs = $this->db->get_where('daftar_mhs',array('npm'=>$this->input->post('npm',TRUE)));
- $ambil_id_kamar = $this->db->get_where('kamar',array('kamar'=>$this->input->post('kamar',TRUE)));
- foreach ($ambil_id_mhs->result() as $main){
- foreach ($ambil_id_kamar->result() as $mhs){
- $kamar_id=$mhs->id;
- $mhs_id=$main->id;
- }
- }
- $data_kamar=array(
- 'id_mhs' => $mhs_id,
- 'id_kamar' => $kamar_id
- );
- $this->admin_model->insert($data);
- $this->mhs_kamar_model->insert($data_kamar);
- $this->session->set_flashdata('message', 'Create Record Success');
- redirect(site_url('admin_mahad_2014/'));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement