CRUD participant data [Bagian 17]

The previous article described the administrator’s first task website Course registration to set the available schedule.

Another task of the admin is to check the data of the participants who take the course material. To remind the material of the manufacturing process website this registration was given by the author shortcut Item available below.

Also read:

VIEW, EDIT AND DELETE PARTICIPANT DATA

1. Paste the following code in. added 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. Do Files admin_participant.php by doing 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. Create views participant.php to display the data of the participants who have requested the desired course material in Folder C: xampp htdocs inwepo application views admin.

So when the url opens http: // localhost / inwepo / admin / welcome / participants a page like this appears:

4. Create views edit_participant.php to display the data of the participants who have requested the desired course material in Folder C: xampp htdocs inwepo application views admin.

Edit Peserta

Silahkan mengubah peserta kursus

So the admin can change the participant’s name if something goes wrong. The display for the code above looks like the image below:

The author has also prepared Source code for the above ad for readers to download. It’s also because script quite a few programs, so the author only includes a part of the program.

For the next article, the author will provide Unsubscribe function on the admin dashboard. The next article will also be the final step in creating a course registration website that uses the Codeigniter framework.

So don’t miss it, loyal friend of Inwepo. That’s all and thanks.

DOWNLOAD

welcome.php

admin_participant.php

participant.php

edit_participant.php






Leave a Reply

Your email address will not be published.

No NPM Nama Nama Kursus Kelas Jurusan Aksi