Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Insert Prestasi
- public function saveprestasi_post()
- {
- $username = trim($this->post('username'));
- $id = trim($this->post('id')); // Biodata ID
- $event = trim($this->post('nama_event'));
- $tempat = trim($this->post('tempat'));
- $tahun = trim($this->post('tahun'));
- $juara = trim($this->post('juara'));
- $catatan = trim($this->post('catatan'));
- $keterangan = trim($this->post('keterangan'));
- if ($username == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Username kosong.',
- ];
- } elseif ($event == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Nama Event kosong.',
- ];
- } elseif ($tempat == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Nama Tempat kosong.',
- ];
- } elseif ($tahun == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Tahun kosong.',
- ];
- } elseif ($juara == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Juara kosong.',
- ];
- } else {
- $data = array(
- 'biodata_id' => $id,
- 'prestasi_even' => strtoupper(trim(stripHTMLtags($event))),
- 'prestasi_tempat' => strtoupper(trim(stripHTMLtags($tempat))),
- 'prestasi_tahun' => strtoupper(trim(stripHTMLtags($tahun))),
- 'prestasi_juara' => strtoupper(trim(stripHTMLtags($juara))),
- 'prestasi_catatan' => strtoupper(trim(stripHTMLtags($catatan))),
- 'prestasi_keterangan' => strtoupper(trim(stripHTMLtags($keterangan))),
- 'prestasi_update' => date('Y-m-d H:i:s'),
- );
- $this->db->insert('olga_bio_prestasi', $data);
- $response = ['resp_error' => false, 'resp_msg' => 'success'];
- }
- $this->response($response, 200);
- }
Add Comment
Please, Sign In to add comment