Skip to content
Advertisement

Codeigniter doesn’t let me update entry, because some fields must be unique

So what I’m trying to do:

  1. Pull User data from database, including email address, username etc.

  2. Edit it

  3. Save it

But I want to keep username and email unique. And for this I’m setting validation rules like this:

JavaScript

And as you can see I have is_unique[users.username] and is_unique[users.email] rules. But it doesn’t let me update my entry using this rules.

So the question is, how can I update database entry, and keep those 2 fields unique(username and email)?

Advertisement

Answer

use the call back validation function

JavaScript

in model

JavaScript

use same for the user name….

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement