Tutorial on Creating a Web Course Registration Using Codeigniter: CRUD Participant Data [Bagian 17]
The previous article has described the first task of the administrator website course registration to set the available schedule.
Another task of the admin is to check the data of participants who will take the course material. To remind the material about the manufacturing process website this registration, the author has given link articles available below.
Read also:
HOW TO SHOW, EDIT AND DELETE PARTICIPANT DATA
1. Add the following code in files welcome.php contained in folder C:\xampp\htdocs\inwepo\application\controllers\admin.
function peserta() { $query = $this->admin_peserta->selectAll(); $data['peserta']=$query; $user = $this->session->userdata('username'); $this->data['pengguna'] = $this->m_login->data($user); $this->load->view('admin/header',$this->data); $this->load->view('admin/peserta',$data); $this->load->view('admin/footer'); } function hapus_ps($id) { $this->admin_peserta->delete($id); redirect('admin/welcome/peserta'); } function ubah_ps($id) { if($_POST==NULL) { $data['peserta'] = $this->admin_peserta->select($id); $user = $this->session->userdata('username'); $this->data['pengguna'] = $this->m_login->data($user); $this->load->view('admin/header',$this->data); $this->load->view('admin/edit_peserta',$data); $this->load->view('admin/footer'); }else { $npm=$this->input->post('npm'); $nama=$this->input->post('nama'); $nm_kursus=$this->input->post('nm_kursus'); $periode=$this->input->post('periode'); $kelas=$this->input->post('kelas'); $jurusan=$this->input->post('jurusan'); $this->admin_peserta->update($id,$npm,$nama,$nm_kursus,$periode,$kelas,$jurusan); redirect('admin/welcome/peserta'); } }
2. Make files admin_participant.php in the folder C:\xampp\htdocs\inwepo\application\models.
db->order_by("id","asc"); return $this->db->get('peserta')->result();}function delete($id) { $this->db->delete('peserta', array('id'=>$id));}function update($id,$npm,$nama,$nm_kursus,$periode,$kelas,$jurusan){ $data = array( 'npm'=>$npm, 'nama'=>$nama, 'nm_kursus'=>$nm_kursus, 'periode'=>$periode, 'kelas'=>$kelas, 'jurusan'=>$jurusan, ); $this->db->where('id',$id)->update('peserta', $data);}function select($id) { return $this->db->get_where('peserta', array('id'=>$id))->row();}}
3. Creating views participant.php to display the data of participants who have registered the desired course material in the folder C:\xampp\htdocs\inwepo\application\views\admin.
Kursus Data Peserta
No NPM Nama Nama Kursus Kelas Jurusan Aksi So when the URL is opened http://localhost/inwepo/admin/welcome/participants a page like this will appear:
4. Creating views edit_participant.php to display the data of participants who have registered the desired course material in the folder C:\xampp\htdocs\inwepo\application\views\admin.
Edit Peserta
Silahkan mengubah peserta kursus