Codeigniter Check For Duplicate on Edit Function |
Check For Duplicate on Edit Function
Currently my DB table USERDB userId userName userPassword userEmail userAddress userPhone What I want > Allow to check on "userName" duplication" and if "userName" return > true , then it allow to edit other textfield. Problem Met: > When i did not change anything on my "userName" field , and i edited > userEmail, it will always return FALSE due to my "userName" is > duplicate with current DB data. $checkvalidation = $this->userdb->UsernameDuplicatechecking($userName); if($checkvalidation == TRUE){ $this->userdb->updateUser($userName,$userEmail,$userAddress,$userPhone,$id); }else{ $this->session->set_flashdata('errormessage', 'Duplicate'); redirect("User/EditUserAccount/$id"); } Update Model Code public function updateUser($userName,$userEmail,$userAddress,$userPhone,$id); { $UserArray = array( 'userName' => $userName, 'userEmail' => $userEmail, 'userAddress' => $userAddress, 'userPhone' => $userPhone, ); $this->db->set($UserArray); $this->db->where('userId',$id); $this->db->update('USERDB'); } |
Messages In This Thread |
Codeigniter Check For Duplicate on Edit Function - by incognitorecon - 08-02-2019, 08:13 PM
RE: Codeigniter Check For Duplicate on Edit Function - by PaulD - 08-04-2019, 05:17 AM
RE: Codeigniter Check For Duplicate on Edit Function - by includebeer - 08-05-2019, 07:17 AM
|