Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Update Profil
- public function updateprofil_post()
- {
- $username = trim($this->post('username'));
- $nama = trim($this->post('nama'));
- $tempat_lahir = trim($this->post('tempat_lahir'));
- $tanggal_lahir = trim($this->post('tanggal_lahir'));
- $alamat = trim($this->post('alamat'));
- $no_telepon = trim($this->post('no_telepon'));
- $email = trim($this->post('email'));
- if ($username == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Username kosong.',
- ];
- } elseif ($nama == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Nama masih kosong.',
- ];
- } elseif ($tempat_lahir == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Tempat Lahir masih kosong.',
- ];
- } elseif ($tanggal_lahir == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Tanggal Lahir masih kosong.',
- ];
- } elseif ($alamat == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Alamat masih kosong.',
- ];
- } elseif ($no_telepon == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'No. Telepon masih kosong.',
- ];
- } elseif ($email == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Email masih kosong.',
- ];
- } else {
- $data = array(
- 'user_name' => strtoupper($nama),
- 'tempat_lahir' => strtoupper($tempat_lahir),
- 'tanggal_lahir' => $tanggal_lahir,
- 'alamat_rumah' => strtoupper(trim($alamat)),
- 'no_telepon' => trim($no_telepon),
- 'user_email' => trim($email),
- 'user_date_update' => date('Y-m-d'),
- 'user_time_update' => date('Y-m-d H:i:s'),
- );
- $this->db->where('user_username', $username);
- $this->db->update('bpmppt_users', $data);
- $response = [
- 'resp_error' => false,
- 'resp_msg' => 'Profil Update',
- ];
- }
- $this->response($response, 200);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement